From 84b9ea23b0903484ef2e2ed7c9826f9869835bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Sat, 1 Nov 2025 01:16:46 +0300 Subject: [PATCH] =?UTF-8?q?BusinessParty=20Entity=20=C3=A7al=C4=B1=C5=9Fma?= =?UTF-8?q?s=C4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Enums/TableNameEnum.cs | 13 +- .../TableNameResolver.cs | 12 + .../Entities/Tenant/SupplyChain/Customer.cs | 23 + .../Tenant/SupplyChain/CustomerSegment.cs | 17 + .../Tenant/SupplyChain/CustomerType.cs | 18 + .../Tenant/SupplyChain/MaterialType.cs | 3 +- .../Entities/Tenant/SupplyChain/Partner.cs | 50 + .../Tenant/SupplyChain/PartnerBank.cs | 29 + .../Tenant/SupplyChain/PartnerCertificate.cs | 17 + .../Tenant/SupplyChain/PartnerContact.cs | 21 + .../Tenant/SupplyChain/PartnerStatus.cs | 18 + .../Tenant/SupplyChain/PartnerType.cs | 12 + .../Tenant/SupplyChain/PaymentTerm.cs | 14 + .../Entities/Tenant/SupplyChain/Supply.cs | 49 + .../Tenant/SupplyChain/SupplyCardType.cs | 17 + .../Entities/Tenant/SupplyChain/SupplyType.cs | 17 + .../EntityFrameworkCore/PlatformDbContext.cs | 351 +++-- ....cs => 20251031221233_Initial.Designer.cs} | 1202 ++++++++++++++++- ...7_Initial.cs => 20251031221233_Initial.cs} | 662 ++++++++- .../PlatformDbContextModelSnapshot.cs | 1200 ++++++++++++++++ ui/src/mocks/mockBusinessParties.ts | 6 +- ui/src/types/crm.ts | 2 +- 22 files changed, 3650 insertions(+), 103 deletions(-) create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Customer.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/CustomerSegment.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/CustomerType.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Partner.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerBank.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerCertificate.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerContact.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerStatus.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerType.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PaymentTerm.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Supply.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/SupplyCardType.cs create mode 100644 api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/SupplyType.cs rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251031075637_Initial.Designer.cs => 20251031221233_Initial.Designer.cs} (91%) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251031075637_Initial.cs => 20251031221233_Initial.cs} (90%) diff --git a/api/src/Kurs.Platform.Domain.Shared/Enums/TableNameEnum.cs b/api/src/Kurs.Platform.Domain.Shared/Enums/TableNameEnum.cs index 39b5391a..aedcf002 100644 --- a/api/src/Kurs.Platform.Domain.Shared/Enums/TableNameEnum.cs +++ b/api/src/Kurs.Platform.Domain.Shared/Enums/TableNameEnum.cs @@ -136,5 +136,16 @@ public enum TableNameEnum SocialComment, SocialLike, MaterialType, - MaterialGroup + MaterialGroup, + PaymentTerm, + Partner, + PartnerBank, + PartnerCertificate, + PartnerContact, + SupplyType, + SupplyCardType, + Supply, + CustomerType, + CustomerSegment, + Customer } \ No newline at end of file diff --git a/api/src/Kurs.Platform.Domain.Shared/TableNameResolver.cs b/api/src/Kurs.Platform.Domain.Shared/TableNameResolver.cs index f5329bf5..026800f4 100644 --- a/api/src/Kurs.Platform.Domain.Shared/TableNameResolver.cs +++ b/api/src/Kurs.Platform.Domain.Shared/TableNameResolver.cs @@ -88,6 +88,9 @@ public static class TableNameResolver { nameof(TableNameEnum.BlogPost), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Administration) }, { nameof(TableNameEnum.Demo), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Administration) }, { nameof(TableNameEnum.Contact), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Administration) }, + { nameof(TableNameEnum.PartnerBank), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Administration) }, + { nameof(TableNameEnum.PartnerCertificate), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Administration) }, + { nameof(TableNameEnum.PartnerContact), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Administration) }, // 🔹 PARTICIPANT { nameof(TableNameEnum.Interesting), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Participant) }, @@ -160,6 +163,15 @@ public static class TableNameResolver //Supply Chain { nameof(TableNameEnum.MaterialType), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, { nameof(TableNameEnum.MaterialGroup), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, + { nameof(TableNameEnum.PaymentTerm), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, + { nameof(TableNameEnum.SupplyType), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, + { nameof(TableNameEnum.SupplyCardType), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, + { nameof(TableNameEnum.Supply), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, + + //Crm + { nameof(TableNameEnum.Customer), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Crm) }, + { nameof(TableNameEnum.CustomerSegment), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Crm) }, + { nameof(TableNameEnum.CustomerType), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Crm) }, // 🔹 ACCOUNTING { nameof(TableNameEnum.Bank), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Accounting) }, diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Customer.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Customer.cs new file mode 100644 index 00000000..02ba44d3 --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Customer.cs @@ -0,0 +1,23 @@ +using System; + +namespace Kurs.Platform.Entities; + +public class Customer : Partner +{ + public PartnerType PartyType { get; set; } = PartnerType.Customer; + + public Guid? CustomerTypeId { get; set; } + public CustomerType? CustomerType { get; set; } + + public Guid? CustomerSegmentId { get; set; } + public CustomerSegment? CustomerSegment { get; set; } + + public Guid AssignedEmployeeId { get; set; } + public Employee? AssignedEmployee { get; set; } + + public string TeamCode { get; set; } // Organization Unit Code + + public decimal TotalRevenue { get; set; } // Toplam Gelir + public decimal AverageOrderValue { get; set; } // Ortalama Sipariş Değeri + public decimal LifetimeValue { get; set; } // Müşteri Ömrü Değeri +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/CustomerSegment.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/CustomerSegment.cs new file mode 100644 index 00000000..b5e6deee --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/CustomerSegment.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Kurs.Platform.Entities; + +public class CustomerSegment : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } + + public ICollection Customers { get; set; } +} diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/CustomerType.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/CustomerType.cs new file mode 100644 index 00000000..d9c405a0 --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/CustomerType.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Kurs.Platform.Entities; + +public class CustomerType : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } + + public ICollection Customers { get; set; } + +} diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/MaterialType.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/MaterialType.cs index 727e9f90..32579a73 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/MaterialType.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/MaterialType.cs @@ -1,4 +1,3 @@ -// Domain/Entities/MmMaterialType.cs using System; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; @@ -8,7 +7,7 @@ namespace Kurs.Platform.Entities; public class MaterialType : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } - + public string Code { get; set; } public string Name { get; set; } public string Description { get; set; } diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Partner.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Partner.cs new file mode 100644 index 00000000..1e6b0761 --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Partner.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Kurs.Platform.Entities; + +public class Partner : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Code { get; set; } + public string Name { get; set; } + + public Guid? SectorId { get; set; } + public Sector? Sector { get; set; } + + public long TaxNumber { get; set; } + public string? TaxOffice { get; set; } + + public string Country { get; set; } + public string City { get; set; } + public string District { get; set; } + public string Street { get; set; } + public string Address1 { get; set; } + public string Address2 { get; set; } + public string PostalCode { get; set; } + public string Phone { get; set; } + public string Mobile { get; set; } + public string Fax { get; set; } + public string Email { get; set; } + public string Website { get; set; } + + public Guid? CurrencyId { get; set; } + public Currency? Currency { get; set; } + + public Guid? PaymentTermId { get; set; } + public PaymentTerm? PaymentTerm { get; set; } + + public decimal CreditLimit { get; set; } + public DateTime LastOrderDate { get; set; } + + public PartnerStatus Status { get; set; } + + public ICollection Certificates { get; set; } + public ICollection Banks { get; set; } + public ICollection Contacts { get; set; } +} + + diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerBank.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerBank.cs new file mode 100644 index 00000000..ff87b77c --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerBank.cs @@ -0,0 +1,29 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Kurs.Platform.Entities; + +public class PartnerBank : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + public Guid PartnerId { get; set; } + public Partner Partner { get; set; } + + public string BankName { get; set; } + public string AccountNumber { get; set; } //Hesap Numarası + public string Iban { get; set; } //IBAN + public string SwiftCode { get; set; } //BIC + public string AccountOwner { get; set; } //Hesap Sahibi + public string BranchName { get; set; } //Şube Adı + public string AccountType { get; set; } //Hesap Türü + + public Guid? CurrencyId { get; set; } + public Currency? Currency { get; set; } + + public decimal Balance { get; set; } + public decimal OverdraftLimit { get; set; } + public decimal DailyTransferLimit { get; set; } + public bool IsDefault { get; set; } + public bool IsActive { get; set; } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerCertificate.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerCertificate.cs new file mode 100644 index 00000000..e593f21e --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerCertificate.cs @@ -0,0 +1,17 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Kurs.Platform.Entities; + +public class PartnerCertificate : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + public Guid PartnerId { get; set; } + public Partner Partner { get; set; } + + public string Certificate { get; set; } // e.g., ISO 9001 + public string Issuer { get; set; } // e.g., Certification Body Name + public DateTime IssueDate { get; set; } // e.g., 2020-01-01 + public DateTime ExpiryDate { get; set; } // e.g., 2023-01-01 +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerContact.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerContact.cs new file mode 100644 index 00000000..6bb4b1e9 --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerContact.cs @@ -0,0 +1,21 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Kurs.Platform.Entities; + +public class PartnerContact : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + public Guid PartnerId { get; set; } + public Partner Partner { get; set; } + + public string FullName { get; set; } + public string Title { get; set; } + public string Department { get; set; } + public string Email { get; set; } + public string Phone { get; set; } + public string Mobile { get; set; } + public bool IsPrimary { get; set; } + public bool IsActive { get; set; } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerStatus.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerStatus.cs new file mode 100644 index 00000000..e2b10b47 --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerStatus.cs @@ -0,0 +1,18 @@ +using System.Runtime.Serialization; + +namespace Kurs.Platform.Entities; + +public enum PartnerStatus +{ + [EnumMember(Value = "Prospect")] + Prospect, // Aday + + [EnumMember(Value = "Active")] + Active, // Aktif + + [EnumMember(Value = "Inactive")] + Inactive, // Pasif + + [EnumMember(Value = "Blocked")] + Blocked, // Engellenmiş +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerType.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerType.cs new file mode 100644 index 00000000..eb5e3275 --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PartnerType.cs @@ -0,0 +1,12 @@ +using System.Runtime.Serialization; + +namespace Kurs.Platform.Entities; + +public enum PartnerType +{ + [EnumMember(Value = "Customer")] + Customer, // Müşteri + + [EnumMember(Value = "Supplier")] + Supplier, // Tedarikçi +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PaymentTerm.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PaymentTerm.cs new file mode 100644 index 00000000..c05c13c3 --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/PaymentTerm.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Kurs.Platform.Entities; + +public class PaymentTerm : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } +} + + diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Supply.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Supply.cs new file mode 100644 index 00000000..b0c2f8e9 --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/Supply.cs @@ -0,0 +1,49 @@ +using System; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text.Json; + +namespace Kurs.Platform.Entities; + +public class Supply : Partner +{ + public PartnerType PartyType { get; set; } = PartnerType.Supplier; + + public Guid? SupplierTypeId { get; set; } + public SupplyType? SupplierType { get; set; } + + public string CardNumber { get; set; } + + public Guid? SupplyCardTypeId { get; set; } + public SupplyCardType? SupplyCardType { get; set; } + + public DateTime ValidFrom { get; set; } + public DateTime ValidTo { get; set; } + public decimal CurrentBalance { get; set; } + public decimal DiscountRate { get; set; } + + public string? PerformanceMetricsJson { get; set; } + + [NotMapped] + public PerformanceMetrics PerformanceMetrics + { + get + { + if (!string.IsNullOrEmpty(PerformanceMetricsJson)) + return JsonSerializer.Deserialize(PerformanceMetricsJson); + + return new PerformanceMetrics(); + } + set { PerformanceMetricsJson = JsonSerializer.Serialize(value); } + } +} + +public class PerformanceMetrics +{ + public int DeliveryPerformance { get; set; } + public int QualityRating { get; set; } + public int PriceCompetitiveness { get; set; } + public int Responsiveness { get; set; } + public int ComplianceRating { get; set; } + public int OverallScore { get; set; } + public DateTime LastEvaluationDate { get; set; } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/SupplyCardType.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/SupplyCardType.cs new file mode 100644 index 00000000..d090108e --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/SupplyCardType.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Kurs.Platform.Entities; + +public class SupplyCardType : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } + + public ICollection Supplies { get; set; } +} diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/SupplyType.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/SupplyType.cs new file mode 100644 index 00000000..04cfb31f --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/SupplyChain/SupplyType.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Kurs.Platform.Entities; + +public class SupplyType : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } + + public ICollection Supplies { get; set; } +} diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index d4ab0c20..d1508007 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -38,6 +38,8 @@ public class PlatformDbContext : ITenantManagementDbContext { #region Saas from the modules + public DbSet Tenants { get; set; } + public DbSet TenantConnectionStrings { get; set; } public DbSet AiBots { get; set; } public DbSet Branches { get; set; } public DbSet BranchUsers { get; set; } @@ -66,10 +68,6 @@ public class PlatformDbContext : public DbSet ReportCategories { get; set; } public DbSet Activities { get; set; } public DbSet IpRestrictions { get; set; } - #endregion - - #region Definitions from the modules - public DbSet Sectors { get; set; } public DbSet ContactTags { get; set; } public DbSet ContactTitles { get; set; } public DbSet Currencies { get; set; } @@ -77,44 +75,17 @@ public class PlatformDbContext : public DbSet Countries { get; set; } public DbSet Cities { get; set; } public DbSet Districts { get; set; } - public DbSet SkillTypes { get; set; } - public DbSet Skills { get; set; } - public DbSet SkillLevels { get; set; } - public DbSet UomCategories { get; set; } - public DbSet Uoms { get; set; } - public DbSet Banks { get; set; } - public DbSet Behaviors { get; set; } - public DbSet BankAccounts { get; set; } - - //Student - public DbSet Schedules { get; set; } - public DbSet ScheduleLessons { get; set; } - public DbSet ClassTypes { get; set; } - public DbSet Classes { get; set; } - public DbSet LessonPeriods { get; set; } - public DbSet Lawyers { get; set; } - public DbSet Diseases { get; set; } - public DbSet Documents { get; set; } - public DbSet InterestAreas { get; set; } - public DbSet RegistrationMethods { get; set; } - public DbSet RegistrationTypes { get; set; } - public DbSet Sources { get; set; } - public DbSet NoteTypes { get; set; } - public DbSet EducationStatuses { get; set; } - public DbSet Programs { get; set; } - public DbSet Psychologists { get; set; } - public DbSet SalesRejectionReasons { get; set; } - public DbSet Levels { get; set; } - public DbSet ClassCancellationReasons { get; set; } - public DbSet MeetingMethods { get; set; } - public DbSet MeetingResults { get; set; } - public DbSet Vaccines { get; set; } - public DbSet Vehicles { get; set; } - public DbSet WorkHours { get; set; } - #endregion - #region Web Site from the modules + #region Administrator from the modules + public DbSet Users { get; set; } + public DbSet Roles { get; set; } + public DbSet ClaimTypes { get; set; } + public DbSet OrganizationUnits { get; set; } + public DbSet SecurityLogs { get; set; } + public DbSet LinkUsers { get; set; } + public DbSet UserDelegations { get; set; } + public DbSet Sessions { get; set; } public DbSet Abouts { get; set; } public DbSet Services { get; set; } public DbSet Products { get; set; } @@ -126,9 +97,65 @@ public class PlatformDbContext : public DbSet BlogCategories { get; set; } public DbSet Demos { get; set; } public DbSet Contacts { get; set; } + public DbSet Sectors { get; set; } + public DbSet SkillTypes { get; set; } + public DbSet Skills { get; set; } + public DbSet SkillLevels { get; set; } + public DbSet UomCategories { get; set; } + public DbSet Uoms { get; set; } + public DbSet WorkHours { get; set; } + public DbSet Behaviors { get; set; } + public DbSet Diseases { get; set; } + public DbSet Documents { get; set; } + public DbSet EducationStatuses { get; set; } + public DbSet Vaccines { get; set; } + public DbSet Vehicles { get; set; } + public DbSet Psychologists { get; set; } + public DbSet Lawyers { get; set; } + public DbSet Partners { get; set; } + #endregion + + #region Intranet + public DbSet Events { get; set; } + public DbSet EventCategories { get; set; } + public DbSet EventTypes { get; set; } + public DbSet EventPhotos { get; set; } + public DbSet EventComments { get; set; } + public DbSet Meals { get; set; } + public DbSet Reservations { get; set; } + public DbSet ShuttleRoutes { get; set; } + public DbSet Announcements { get; set; } + public DbSet Visitors { get; set; } + + public DbSet SocialPosts { get; set; } + public DbSet SocialLocations { get; set; } + public DbSet SocialMedias { get; set; } + public DbSet SocialPollOptions { get; set; } + public DbSet SocialComments { get; set; } + public DbSet SocialLikes { get; set; } + #endregion + + #region Participant from the modules + public DbSet MeetingMethods { get; set; } + public DbSet MeetingResults { get; set; } + public DbSet Sources { get; set; } + public DbSet InterestAreas { get; set; } + public DbSet SalesRejectionReasons { get; set; } + public DbSet NoteTypes { get; set; } #endregion #region Coordinator from the modules + public DbSet Programs { get; set; } + public DbSet Schedules { get; set; } + public DbSet ScheduleLessons { get; set; } + public DbSet RegistrationTypes { get; set; } + public DbSet RegistrationMethods { get; set; } + public DbSet ClassTypes { get; set; } + public DbSet Classes { get; set; } + public DbSet Levels { get; set; } + public DbSet ClassCancellationReasons { get; set; } + public DbSet LessonPeriods { get; set; } + public DbSet ClassSessions { get; set; } public DbSet Participants { get; set; } public DbSet AttendanceRecords { get; set; } @@ -141,24 +168,6 @@ public class PlatformDbContext : #endregion - #region Administrator from the modules - - //Identity - public DbSet Users { get; set; } - public DbSet Roles { get; set; } - public DbSet ClaimTypes { get; set; } - public DbSet OrganizationUnits { get; set; } - public DbSet SecurityLogs { get; set; } - public DbSet LinkUsers { get; set; } - public DbSet UserDelegations { get; set; } - public DbSet Sessions { get; set; } - - // Tenant Management - public DbSet Tenants { get; set; } - public DbSet TenantConnectionStrings { get; set; } - - #endregion - #region Hr public DbSet Employees { get; set; } public DbSet Departments { get; set; } @@ -182,29 +191,27 @@ public class PlatformDbContext : #endregion - #region Intranet - public DbSet Events { get; set; } - public DbSet EventCategories { get; set; } - public DbSet EventTypes { get; set; } - public DbSet EventPhotos { get; set; } - public DbSet EventComments { get; set; } - public DbSet Meals { get; set; } - public DbSet Reservations { get; set; } - public DbSet ShuttleRoutes { get; set; } - public DbSet Announcements { get; set; } - public DbSet Visitors { get; set; } - - public DbSet SocialPosts { get; set; } - public DbSet SocialLocations { get; set; } - public DbSet SocialMedias { get; set; } - public DbSet SocialPollOptions { get; set; } - public DbSet SocialComments { get; set; } - public DbSet SocialLikes { get; set; } - #endregion - #region Supply Chain public DbSet MaterialTypes { get; set; } public DbSet MaterialGroups { get; set; } + public DbSet PaymentTerms { get; set; } + + public DbSet SupplyTypes { get; set; } + public DbSet SupplyCardTypes { get; set; } + public DbSet Supplies { get; set; } + + public DbSet CustomerTypes { get; set; } + public DbSet CustomerSegments { get; set; } + public DbSet Customers { get; set; } + + public DbSet PartnerBanks { get; set; } + public DbSet PartnerCertificates { get; set; } + public DbSet PartnerContacts { get; set; } + #endregion + + #region Accounting + public DbSet Banks { get; set; } + public DbSet BankAccounts { get; set; } #endregion public PlatformDbContext(DbContextOptions options) @@ -2217,5 +2224,193 @@ public class PlatformDbContext : .HasForeignKey(x => x.ParentGroupId) .OnDelete(DeleteBehavior.Restrict); }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.PaymentTerm)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Name).IsRequired().HasMaxLength(100); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.SupplyType)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Name).IsRequired().HasMaxLength(50); + b.Property(x => x.Description).HasMaxLength(500); + b.Property(x => x.IsActive).HasDefaultValue(true); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.SupplyCardType)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Name).IsRequired().HasMaxLength(50); + b.Property(x => x.Description).HasMaxLength(500); + b.Property(x => x.IsActive).HasDefaultValue(true); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Supply)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(p => p.Code).IsRequired().HasMaxLength(64); + b.Property(p => p.Name).IsRequired().HasMaxLength(256); + b.Property(p => p.TaxNumber).IsRequired(); + b.Property(p => p.TaxOffice).HasMaxLength(128); + b.Property(p => p.Country).IsRequired().HasMaxLength(64); + b.Property(p => p.City).IsRequired().HasMaxLength(64); + b.Property(p => p.District).HasMaxLength(64); + b.Property(p => p.Street).HasMaxLength(128); + b.Property(p => p.Address1).HasMaxLength(256); + b.Property(p => p.Address2).HasMaxLength(256); + b.Property(p => p.PostalCode).HasMaxLength(16); + b.Property(p => p.Phone).HasMaxLength(32); + b.Property(p => p.Mobile).HasMaxLength(32); + b.Property(p => p.Fax).HasMaxLength(32); + b.Property(p => p.Email).HasMaxLength(128); + b.Property(p => p.Website).HasMaxLength(128); + b.Property(p => p.CreditLimit).HasPrecision(18, 2); + b.Property(p => p.Status).IsRequired(); + + b.Property(x => x.CardNumber).HasMaxLength(64); + b.Property(x => x.CurrentBalance).HasDefaultValue(0); + b.Property(x => x.DiscountRate).HasDefaultValue(0); + b.Property(a => a.PerformanceMetricsJson).HasColumnType("text"); + + b.HasOne(x => x.SupplierType) + .WithMany(x => x.Supplies) + .HasForeignKey(x => x.SupplierTypeId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.SupplyCardType) + .WithMany(x => x.Supplies) + .HasForeignKey(x => x.SupplyCardTypeId) + .OnDelete(DeleteBehavior.Restrict); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.CustomerType)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Name).IsRequired().HasMaxLength(50); + b.Property(x => x.Description).HasMaxLength(500); + b.Property(x => x.IsActive).HasDefaultValue(true); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.CustomerSegment)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Name).IsRequired().HasMaxLength(50); + b.Property(x => x.Description).HasMaxLength(500); + b.Property(x => x.IsActive).HasDefaultValue(true); + }); + + builder.Ignore(); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Customer)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(p => p.Code).IsRequired().HasMaxLength(64); + b.Property(p => p.Name).IsRequired().HasMaxLength(256); + b.Property(p => p.TaxNumber).IsRequired(); + b.Property(p => p.TaxOffice).HasMaxLength(128); + b.Property(p => p.Country).IsRequired().HasMaxLength(64); + b.Property(p => p.City).IsRequired().HasMaxLength(64); + b.Property(p => p.District).HasMaxLength(64); + b.Property(p => p.Street).HasMaxLength(128); + b.Property(p => p.Address1).HasMaxLength(256); + b.Property(p => p.Address2).HasMaxLength(256); + b.Property(p => p.PostalCode).HasMaxLength(16); + b.Property(p => p.Phone).HasMaxLength(32); + b.Property(p => p.Mobile).HasMaxLength(32); + b.Property(p => p.Fax).HasMaxLength(32); + b.Property(p => p.Email).HasMaxLength(128); + b.Property(p => p.Website).HasMaxLength(128); + b.Property(p => p.CreditLimit).HasPrecision(18, 2); + b.Property(p => p.Status).IsRequired(); + + b.Property(x => x.TeamCode).HasMaxLength(95); + b.Property(x => x.TotalRevenue).HasDefaultValue(0); + b.Property(x => x.AverageOrderValue).HasDefaultValue(0); + b.Property(x => x.LifetimeValue).HasDefaultValue(0); + + b.HasOne(x => x.CustomerType) + .WithMany(x => x.Customers) + .HasForeignKey(x => x.CustomerTypeId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.CustomerSegment) + .WithMany(x => x.Customers) + .HasForeignKey(x => x.CustomerSegmentId) + .OnDelete(DeleteBehavior.Restrict); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.PartnerBank)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(pb => pb.BankName).IsRequired().HasMaxLength(128); + b.Property(pb => pb.AccountNumber).IsRequired().HasMaxLength(50); + b.Property(pb => pb.Iban).IsRequired().HasMaxLength(34); + b.Property(pb => pb.SwiftCode).HasMaxLength(11); + b.Property(pb => pb.AccountOwner).IsRequired().HasMaxLength(128); + b.Property(pb => pb.BranchName).HasMaxLength(128); + b.Property(pb => pb.AccountType).HasMaxLength(64); + b.Property(pb => pb.Balance).HasPrecision(18, 2); + b.Property(pb => pb.OverdraftLimit).HasPrecision(18, 2); + b.Property(pb => pb.DailyTransferLimit).HasPrecision(18, 2); + b.Property(pb => pb.IsDefault).HasDefaultValue(false); + b.Property(pb => pb.IsActive).HasDefaultValue(true); + + b.HasOne(pb => pb.Partner) + .WithMany(x => x.Banks) + .HasForeignKey(pb => pb.PartnerId) + .OnDelete(DeleteBehavior.Restrict); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.PartnerCertificate)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Certificate).IsRequired().HasMaxLength(50); + b.Property(x => x.Issuer).HasMaxLength(500); + + b.HasOne(x => x.Partner) + .WithMany(x => x.Certificates) + .HasForeignKey(x => x.PartnerId) + .OnDelete(DeleteBehavior.Restrict); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.PartnerContact)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.FullName).IsRequired().HasMaxLength(128); + b.Property(x => x.Title).HasMaxLength(64); + b.Property(x => x.Department).HasMaxLength(64); + b.Property(x => x.Email).HasMaxLength(128); + b.Property(x => x.Phone).HasMaxLength(32); + b.Property(x => x.Mobile).HasMaxLength(32); + b.Property(x => x.IsPrimary).HasDefaultValue(false); + b.Property(x => x.IsActive).HasDefaultValue(true); + + b.HasOne(x => x.Partner) + .WithMany(x => x.Contacts) + .HasForeignKey(x => x.PartnerId) + .OnDelete(DeleteBehavior.Restrict); + }); } } diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031075637_Initial.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031221233_Initial.Designer.cs similarity index 91% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031075637_Initial.Designer.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031221233_Initial.Designer.cs index 7619f7ea..8813089b 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031075637_Initial.Designer.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031221233_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Kurs.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251031075637_Initial")] + [Migration("20251031221233_Initial")] partial class Initial { /// @@ -3047,6 +3047,296 @@ namespace Kurs.Platform.Migrations b.ToTable("T_Sas_CustomEntityField", (string)null); }); + modelBuilder.Entity("Kurs.Platform.Entities.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Address1") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Address2") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("AssignedEmployeeId") + .HasColumnType("uniqueidentifier"); + + b.Property("AverageOrderValue") + .ValueGeneratedOnAdd() + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("City") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Country") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CreditLimit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CurrencyId") + .HasColumnType("uniqueidentifier"); + + b.Property("CustomerSegmentId") + .HasColumnType("uniqueidentifier"); + + b.Property("CustomerTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("District") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Email") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Fax") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LastOrderDate") + .HasColumnType("datetime2"); + + b.Property("LifetimeValue") + .ValueGeneratedOnAdd() + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("Mobile") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PartyType") + .HasColumnType("int"); + + b.Property("PaymentTermId") + .HasColumnType("uniqueidentifier"); + + b.Property("Phone") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("PostalCode") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("SectorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Street") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TaxNumber") + .HasColumnType("bigint"); + + b.Property("TaxOffice") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TeamCode") + .HasMaxLength(95) + .HasColumnType("nvarchar(95)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TotalRevenue") + .ValueGeneratedOnAdd() + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("Website") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedEmployeeId"); + + b.HasIndex("CurrencyId"); + + b.HasIndex("CustomerSegmentId"); + + b.HasIndex("CustomerTypeId"); + + b.HasIndex("PaymentTermId"); + + b.HasIndex("SectorId"); + + b.ToTable("T_Crm_Customer", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.CustomerSegment", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("T_Crm_CustomerSegment", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.CustomerType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("T_Crm_CustomerType", (string)null); + }); + modelBuilder.Entity("Kurs.Platform.Entities.DataSource", b => { b.Property("Id") @@ -6134,6 +6424,399 @@ namespace Kurs.Platform.Migrations b.ToTable("T_Hr_Overtime", (string)null); }); + modelBuilder.Entity("Kurs.Platform.Entities.Partner", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Address1") + .HasColumnType("nvarchar(max)"); + + b.Property("Address2") + .HasColumnType("nvarchar(max)"); + + b.Property("City") + .HasColumnType("nvarchar(max)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreditLimit") + .HasColumnType("decimal(18,2)"); + + b.Property("CurrencyId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("District") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Fax") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastOrderDate") + .HasColumnType("datetime2"); + + b.Property("Mobile") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("PaymentTermId") + .HasColumnType("uniqueidentifier"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("PostalCode") + .HasColumnType("nvarchar(max)"); + + b.Property("SectorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Street") + .HasColumnType("nvarchar(max)"); + + b.Property("TaxNumber") + .HasColumnType("bigint"); + + b.Property("TaxOffice") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Website") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CurrencyId"); + + b.HasIndex("PaymentTermId"); + + b.HasIndex("SectorId"); + + b.ToTable("Partners"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerBank", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AccountNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("AccountOwner") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AccountType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Balance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("BankName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BranchName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CurrencyId") + .HasColumnType("uniqueidentifier"); + + b.Property("CustomerId") + .HasColumnType("uniqueidentifier"); + + b.Property("DailyTransferLimit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Iban") + .IsRequired() + .HasMaxLength(34) + .HasColumnType("nvarchar(34)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDefault") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("OverdraftLimit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("PartnerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SupplyId") + .HasColumnType("uniqueidentifier"); + + b.Property("SwiftCode") + .HasMaxLength(11) + .HasColumnType("nvarchar(11)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("CurrencyId"); + + b.HasIndex("CustomerId"); + + b.HasIndex("PartnerId"); + + b.HasIndex("SupplyId"); + + b.ToTable("T_Adm_PartnerBank", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerCertificate", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Certificate") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExpiryDate") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IssueDate") + .HasColumnType("datetime2"); + + b.Property("Issuer") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PartnerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SupplyId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("PartnerId"); + + b.HasIndex("SupplyId"); + + b.ToTable("T_Adm_PartnerCertificate", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerContact", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Department") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Email") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("FullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsPrimary") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Mobile") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("PartnerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Phone") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("SupplyId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("PartnerId"); + + b.HasIndex("SupplyId"); + + b.ToTable("T_Adm_PartnerContact", (string)null); + }); + modelBuilder.Entity("Kurs.Platform.Entities.PaymentMethod", b => { b.Property("Id") @@ -6191,6 +6874,55 @@ namespace Kurs.Platform.Migrations b.ToTable("T_Adm_PaymentMethod", (string)null); }); + modelBuilder.Entity("Kurs.Platform.Entities.PaymentTerm", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("T_Scp_PaymentTerm", (string)null); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Payroll", b => { b.Property("Id") @@ -8437,6 +9169,265 @@ namespace Kurs.Platform.Migrations b.ToTable("T_Prt_Source", (string)null); }); + modelBuilder.Entity("Kurs.Platform.Entities.Supply", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Address1") + .HasColumnType("nvarchar(max)"); + + b.Property("Address2") + .HasColumnType("nvarchar(max)"); + + b.Property("CardNumber") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("City") + .HasColumnType("nvarchar(max)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreditLimit") + .HasColumnType("decimal(18,2)"); + + b.Property("CurrencyId") + .HasColumnType("uniqueidentifier"); + + b.Property("CurrentBalance") + .ValueGeneratedOnAdd() + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("DiscountRate") + .ValueGeneratedOnAdd() + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("District") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Fax") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastOrderDate") + .HasColumnType("datetime2"); + + b.Property("Mobile") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("PartyType") + .HasColumnType("int"); + + b.Property("PaymentTermId") + .HasColumnType("uniqueidentifier"); + + b.Property("PerformanceMetricsJson") + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("PostalCode") + .HasColumnType("nvarchar(max)"); + + b.Property("SectorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Street") + .HasColumnType("nvarchar(max)"); + + b.Property("SupplierTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("SupplyCardTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("TaxNumber") + .HasColumnType("bigint"); + + b.Property("TaxOffice") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ValidFrom") + .HasColumnType("datetime2"); + + b.Property("ValidTo") + .HasColumnType("datetime2"); + + b.Property("Website") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CurrencyId"); + + b.HasIndex("PaymentTermId"); + + b.HasIndex("SectorId"); + + b.HasIndex("SupplierTypeId"); + + b.HasIndex("SupplyCardTypeId"); + + b.ToTable("T_Scp_Supply", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SupplyCardType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("T_Scp_SupplyCardType", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SupplyType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("T_Scp_SupplyType", (string)null); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Survey", b => { b.Property("Id") @@ -11757,6 +12748,49 @@ namespace Kurs.Platform.Migrations b.Navigation("Entity"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Customer", b => + { + b.HasOne("Kurs.Platform.Entities.Employee", "AssignedEmployee") + .WithMany() + .HasForeignKey("AssignedEmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Kurs.Platform.Entities.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId"); + + b.HasOne("Kurs.Platform.Entities.CustomerSegment", "CustomerSegment") + .WithMany("Customers") + .HasForeignKey("CustomerSegmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Kurs.Platform.Entities.CustomerType", "CustomerType") + .WithMany("Customers") + .HasForeignKey("CustomerTypeId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Kurs.Platform.Entities.PaymentTerm", "PaymentTerm") + .WithMany() + .HasForeignKey("PaymentTermId"); + + b.HasOne("Kurs.Platform.Entities.Sector", "Sector") + .WithMany() + .HasForeignKey("SectorId"); + + b.Navigation("AssignedEmployee"); + + b.Navigation("Currency"); + + b.Navigation("CustomerSegment"); + + b.Navigation("CustomerType"); + + b.Navigation("PaymentTerm"); + + b.Navigation("Sector"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Department", b => { b.HasOne("Kurs.Platform.Entities.CostCenter", "CostCenter") @@ -11996,6 +13030,90 @@ namespace Kurs.Platform.Migrations b.Navigation("Employee"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Partner", b => + { + b.HasOne("Kurs.Platform.Entities.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId"); + + b.HasOne("Kurs.Platform.Entities.PaymentTerm", "PaymentTerm") + .WithMany() + .HasForeignKey("PaymentTermId"); + + b.HasOne("Kurs.Platform.Entities.Sector", "Sector") + .WithMany() + .HasForeignKey("SectorId"); + + b.Navigation("Currency"); + + b.Navigation("PaymentTerm"); + + b.Navigation("Sector"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerBank", b => + { + b.HasOne("Kurs.Platform.Entities.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId"); + + b.HasOne("Kurs.Platform.Entities.Customer", null) + .WithMany("Banks") + .HasForeignKey("CustomerId"); + + b.HasOne("Kurs.Platform.Entities.Partner", "Partner") + .WithMany("Banks") + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Kurs.Platform.Entities.Supply", null) + .WithMany("Banks") + .HasForeignKey("SupplyId"); + + b.Navigation("Currency"); + + b.Navigation("Partner"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerCertificate", b => + { + b.HasOne("Kurs.Platform.Entities.Customer", null) + .WithMany("Certificates") + .HasForeignKey("CustomerId"); + + b.HasOne("Kurs.Platform.Entities.Partner", "Partner") + .WithMany("Certificates") + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Kurs.Platform.Entities.Supply", null) + .WithMany("Certificates") + .HasForeignKey("SupplyId"); + + b.Navigation("Partner"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerContact", b => + { + b.HasOne("Kurs.Platform.Entities.Customer", null) + .WithMany("Contacts") + .HasForeignKey("CustomerId"); + + b.HasOne("Kurs.Platform.Entities.Partner", "Partner") + .WithMany("Contacts") + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Kurs.Platform.Entities.Supply", null) + .WithMany("Contacts") + .HasForeignKey("SupplyId"); + + b.Navigation("Partner"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.PayrollItem", b => { b.HasOne("Kurs.Platform.Entities.Payroll", "Payroll") @@ -12209,6 +13327,41 @@ namespace Kurs.Platform.Migrations b.Navigation("Employee"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Supply", b => + { + b.HasOne("Kurs.Platform.Entities.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId"); + + b.HasOne("Kurs.Platform.Entities.PaymentTerm", "PaymentTerm") + .WithMany() + .HasForeignKey("PaymentTermId"); + + b.HasOne("Kurs.Platform.Entities.Sector", "Sector") + .WithMany() + .HasForeignKey("SectorId"); + + b.HasOne("Kurs.Platform.Entities.SupplyType", "SupplierType") + .WithMany("Supplies") + .HasForeignKey("SupplierTypeId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Kurs.Platform.Entities.SupplyCardType", "SupplyCardType") + .WithMany("Supplies") + .HasForeignKey("SupplyCardTypeId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Currency"); + + b.Navigation("PaymentTerm"); + + b.Navigation("Sector"); + + b.Navigation("SupplierType"); + + b.Navigation("SupplyCardType"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.SurveyAnswer", b => { b.HasOne("Kurs.Platform.Entities.SurveyQuestion", "Question") @@ -12521,6 +13674,25 @@ namespace Kurs.Platform.Migrations b.Navigation("Fields"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Customer", b => + { + b.Navigation("Banks"); + + b.Navigation("Certificates"); + + b.Navigation("Contacts"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.CustomerSegment", b => + { + b.Navigation("Customers"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.CustomerType", b => + { + b.Navigation("Customers"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Department", b => { b.Navigation("Performans360s"); @@ -12574,6 +13746,15 @@ namespace Kurs.Platform.Migrations b.Navigation("Items"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Partner", b => + { + b.Navigation("Banks"); + + b.Navigation("Certificates"); + + b.Navigation("Contacts"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Payroll", b => { b.Navigation("Items"); @@ -12636,6 +13817,25 @@ namespace Kurs.Platform.Migrations b.Navigation("Media"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Supply", b => + { + b.Navigation("Banks"); + + b.Navigation("Certificates"); + + b.Navigation("Contacts"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SupplyCardType", b => + { + b.Navigation("Supplies"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SupplyType", b => + { + b.Navigation("Supplies"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Survey", b => { b.Navigation("Questions"); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031075637_Initial.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031221233_Initial.cs similarity index 90% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031075637_Initial.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031221233_Initial.cs index 90966b70..1e8b2daf 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031075637_Initial.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251031221233_Initial.cs @@ -1708,6 +1708,50 @@ namespace Kurs.Platform.Migrations table.PrimaryKey("PK_T_Crd_QuestionTag", x => x.Id); }); + migrationBuilder.CreateTable( + name: "T_Crm_CustomerSegment", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Crm_CustomerSegment", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "T_Crm_CustomerType", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Crm_CustomerType", x => x.Id); + }); + migrationBuilder.CreateTable( name: "T_Hr_Badge", columns: table => new @@ -2355,6 +2399,70 @@ namespace Kurs.Platform.Migrations table.PrimaryKey("PK_T_Scp_MaterialType", x => x.Id); }); + migrationBuilder.CreateTable( + name: "T_Scp_PaymentTerm", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Scp_PaymentTerm", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "T_Scp_SupplyCardType", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Scp_SupplyCardType", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "T_Scp_SupplyType", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Scp_SupplyType", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpAuditLogActions", columns: table => new @@ -3509,6 +3617,139 @@ namespace Kurs.Platform.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "Partners", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Code = table.Column(type: "nvarchar(max)", nullable: true), + Name = table.Column(type: "nvarchar(max)", nullable: true), + SectorId = table.Column(type: "uniqueidentifier", nullable: true), + TaxNumber = table.Column(type: "bigint", nullable: false), + TaxOffice = table.Column(type: "nvarchar(max)", nullable: true), + Country = table.Column(type: "nvarchar(max)", nullable: true), + City = table.Column(type: "nvarchar(max)", nullable: true), + District = table.Column(type: "nvarchar(max)", nullable: true), + Street = table.Column(type: "nvarchar(max)", nullable: true), + Address1 = table.Column(type: "nvarchar(max)", nullable: true), + Address2 = table.Column(type: "nvarchar(max)", nullable: true), + PostalCode = table.Column(type: "nvarchar(max)", nullable: true), + Phone = table.Column(type: "nvarchar(max)", nullable: true), + Mobile = table.Column(type: "nvarchar(max)", nullable: true), + Fax = table.Column(type: "nvarchar(max)", nullable: true), + Email = table.Column(type: "nvarchar(max)", nullable: true), + Website = table.Column(type: "nvarchar(max)", nullable: true), + CurrencyId = table.Column(type: "uniqueidentifier", nullable: true), + PaymentTermId = table.Column(type: "uniqueidentifier", nullable: true), + CreditLimit = table.Column(type: "decimal(18,2)", nullable: false), + LastOrderDate = table.Column(type: "datetime2", nullable: false), + Status = table.Column(type: "int", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Partners", x => x.Id); + table.ForeignKey( + name: "FK_Partners_P_Sas_Currency_CurrencyId", + column: x => x.CurrencyId, + principalTable: "P_Sas_Currency", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Partners_T_Sas_Sector_SectorId", + column: x => x.SectorId, + principalTable: "T_Sas_Sector", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Partners_T_Scp_PaymentTerm_PaymentTermId", + column: x => x.PaymentTermId, + principalTable: "T_Scp_PaymentTerm", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "T_Scp_Supply", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + PartyType = table.Column(type: "int", nullable: false), + SupplierTypeId = table.Column(type: "uniqueidentifier", nullable: true), + CardNumber = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + SupplyCardTypeId = table.Column(type: "uniqueidentifier", nullable: true), + ValidFrom = table.Column(type: "datetime2", nullable: false), + ValidTo = table.Column(type: "datetime2", nullable: false), + CurrentBalance = table.Column(type: "decimal(18,2)", nullable: false, defaultValue: 0m), + DiscountRate = table.Column(type: "decimal(18,2)", nullable: false, defaultValue: 0m), + PerformanceMetricsJson = table.Column(type: "text", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Code = table.Column(type: "nvarchar(max)", nullable: true), + Name = table.Column(type: "nvarchar(max)", nullable: true), + SectorId = table.Column(type: "uniqueidentifier", nullable: true), + TaxNumber = table.Column(type: "bigint", nullable: false), + TaxOffice = table.Column(type: "nvarchar(max)", nullable: true), + Country = table.Column(type: "nvarchar(max)", nullable: true), + City = table.Column(type: "nvarchar(max)", nullable: true), + District = table.Column(type: "nvarchar(max)", nullable: true), + Street = table.Column(type: "nvarchar(max)", nullable: true), + Address1 = table.Column(type: "nvarchar(max)", nullable: true), + Address2 = table.Column(type: "nvarchar(max)", nullable: true), + PostalCode = table.Column(type: "nvarchar(max)", nullable: true), + Phone = table.Column(type: "nvarchar(max)", nullable: true), + Mobile = table.Column(type: "nvarchar(max)", nullable: true), + Fax = table.Column(type: "nvarchar(max)", nullable: true), + Email = table.Column(type: "nvarchar(max)", nullable: true), + Website = table.Column(type: "nvarchar(max)", nullable: true), + CurrencyId = table.Column(type: "uniqueidentifier", nullable: true), + PaymentTermId = table.Column(type: "uniqueidentifier", nullable: true), + CreditLimit = table.Column(type: "decimal(18,2)", nullable: false), + LastOrderDate = table.Column(type: "datetime2", nullable: false), + Status = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Scp_Supply", x => x.Id); + table.ForeignKey( + name: "FK_T_Scp_Supply_P_Sas_Currency_CurrencyId", + column: x => x.CurrencyId, + principalTable: "P_Sas_Currency", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_T_Scp_Supply_T_Sas_Sector_SectorId", + column: x => x.SectorId, + principalTable: "T_Sas_Sector", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_T_Scp_Supply_T_Scp_PaymentTerm_PaymentTermId", + column: x => x.PaymentTermId, + principalTable: "T_Scp_PaymentTerm", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_T_Scp_Supply_T_Scp_SupplyCardType_SupplyCardTypeId", + column: x => x.SupplyCardTypeId, + principalTable: "T_Scp_SupplyCardType", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_T_Scp_Supply_T_Scp_SupplyType_SupplierTypeId", + column: x => x.SupplierTypeId, + principalTable: "T_Scp_SupplyType", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( name: "AbpEntityPropertyChanges", columns: table => new @@ -3904,6 +4145,211 @@ namespace Kurs.Platform.Migrations principalColumn: "Id"); }); + migrationBuilder.CreateTable( + name: "T_Adm_PartnerBank", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + PartnerId = table.Column(type: "uniqueidentifier", nullable: false), + BankName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + AccountNumber = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Iban = table.Column(type: "nvarchar(34)", maxLength: 34, nullable: false), + SwiftCode = table.Column(type: "nvarchar(11)", maxLength: 11, nullable: true), + AccountOwner = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + BranchName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + AccountType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + CurrencyId = table.Column(type: "uniqueidentifier", nullable: true), + Balance = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + OverdraftLimit = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + DailyTransferLimit = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + IsDefault = table.Column(type: "bit", nullable: false, defaultValue: false), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), + CustomerId = table.Column(type: "uniqueidentifier", nullable: true), + SupplyId = table.Column(type: "uniqueidentifier", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Adm_PartnerBank", x => x.Id); + table.ForeignKey( + name: "FK_T_Adm_PartnerBank_P_Sas_Currency_CurrencyId", + column: x => x.CurrencyId, + principalTable: "P_Sas_Currency", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_T_Adm_PartnerBank_Partners_PartnerId", + column: x => x.PartnerId, + principalTable: "Partners", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_T_Adm_PartnerBank_T_Scp_Supply_SupplyId", + column: x => x.SupplyId, + principalTable: "T_Scp_Supply", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "T_Adm_PartnerCertificate", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + PartnerId = table.Column(type: "uniqueidentifier", nullable: false), + Certificate = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Issuer = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + IssueDate = table.Column(type: "datetime2", nullable: false), + ExpiryDate = table.Column(type: "datetime2", nullable: false), + CustomerId = table.Column(type: "uniqueidentifier", nullable: true), + SupplyId = table.Column(type: "uniqueidentifier", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Adm_PartnerCertificate", x => x.Id); + table.ForeignKey( + name: "FK_T_Adm_PartnerCertificate_Partners_PartnerId", + column: x => x.PartnerId, + principalTable: "Partners", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_T_Adm_PartnerCertificate_T_Scp_Supply_SupplyId", + column: x => x.SupplyId, + principalTable: "T_Scp_Supply", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "T_Adm_PartnerContact", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + PartnerId = table.Column(type: "uniqueidentifier", nullable: false), + FullName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Title = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Department = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Email = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Phone = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: true), + Mobile = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: true), + IsPrimary = table.Column(type: "bit", nullable: false, defaultValue: false), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), + CustomerId = table.Column(type: "uniqueidentifier", nullable: true), + SupplyId = table.Column(type: "uniqueidentifier", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Adm_PartnerContact", x => x.Id); + table.ForeignKey( + name: "FK_T_Adm_PartnerContact_Partners_PartnerId", + column: x => x.PartnerId, + principalTable: "Partners", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_T_Adm_PartnerContact_T_Scp_Supply_SupplyId", + column: x => x.SupplyId, + principalTable: "T_Scp_Supply", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "T_Crm_Customer", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + PartyType = table.Column(type: "int", nullable: false), + CustomerTypeId = table.Column(type: "uniqueidentifier", nullable: true), + CustomerSegmentId = table.Column(type: "uniqueidentifier", nullable: true), + AssignedEmployeeId = table.Column(type: "uniqueidentifier", nullable: false), + TeamCode = table.Column(type: "nvarchar(95)", maxLength: 95, nullable: true), + TotalRevenue = table.Column(type: "decimal(18,2)", nullable: false, defaultValue: 0m), + AverageOrderValue = table.Column(type: "decimal(18,2)", nullable: false, defaultValue: 0m), + LifetimeValue = table.Column(type: "decimal(18,2)", nullable: false, defaultValue: 0m), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Code = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + SectorId = table.Column(type: "uniqueidentifier", nullable: true), + TaxNumber = table.Column(type: "bigint", nullable: false), + TaxOffice = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Country = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + City = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + District = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Street = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Address1 = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + Address2 = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + PostalCode = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + Phone = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: true), + Mobile = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: true), + Fax = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: true), + Email = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Website = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + CurrencyId = table.Column(type: "uniqueidentifier", nullable: true), + PaymentTermId = table.Column(type: "uniqueidentifier", nullable: true), + CreditLimit = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + LastOrderDate = table.Column(type: "datetime2", nullable: false), + Status = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Crm_Customer", x => x.Id); + table.ForeignKey( + name: "FK_T_Crm_Customer_P_Sas_Currency_CurrencyId", + column: x => x.CurrencyId, + principalTable: "P_Sas_Currency", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_T_Crm_Customer_T_Crm_CustomerSegment_CustomerSegmentId", + column: x => x.CustomerSegmentId, + principalTable: "T_Crm_CustomerSegment", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_T_Crm_Customer_T_Crm_CustomerType_CustomerTypeId", + column: x => x.CustomerTypeId, + principalTable: "T_Crm_CustomerType", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_T_Crm_Customer_T_Sas_Sector_SectorId", + column: x => x.SectorId, + principalTable: "T_Sas_Sector", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_T_Crm_Customer_T_Scp_PaymentTerm_PaymentTermId", + column: x => x.PaymentTermId, + principalTable: "T_Scp_PaymentTerm", + principalColumn: "Id"); + }); + migrationBuilder.CreateTable( name: "T_Hr_CostCenter", columns: table => new @@ -5165,6 +5611,21 @@ namespace Kurs.Platform.Migrations column: "Key", unique: true); + migrationBuilder.CreateIndex( + name: "IX_Partners_CurrencyId", + table: "Partners", + column: "CurrencyId"); + + migrationBuilder.CreateIndex( + name: "IX_Partners_PaymentTermId", + table: "Partners", + column: "PaymentTermId"); + + migrationBuilder.CreateIndex( + name: "IX_Partners_SectorId", + table: "Partners", + column: "SectorId"); + migrationBuilder.CreateIndex( name: "IX_T_Acc_BankAccount_BankId", table: "T_Acc_BankAccount", @@ -5200,6 +5661,56 @@ namespace Kurs.Platform.Migrations table: "T_Adm_OrderItem", column: "OrderId"); + migrationBuilder.CreateIndex( + name: "IX_T_Adm_PartnerBank_CurrencyId", + table: "T_Adm_PartnerBank", + column: "CurrencyId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Adm_PartnerBank_CustomerId", + table: "T_Adm_PartnerBank", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Adm_PartnerBank_PartnerId", + table: "T_Adm_PartnerBank", + column: "PartnerId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Adm_PartnerBank_SupplyId", + table: "T_Adm_PartnerBank", + column: "SupplyId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Adm_PartnerCertificate_CustomerId", + table: "T_Adm_PartnerCertificate", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Adm_PartnerCertificate_PartnerId", + table: "T_Adm_PartnerCertificate", + column: "PartnerId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Adm_PartnerCertificate_SupplyId", + table: "T_Adm_PartnerCertificate", + column: "SupplyId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Adm_PartnerContact_CustomerId", + table: "T_Adm_PartnerContact", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Adm_PartnerContact_PartnerId", + table: "T_Adm_PartnerContact", + column: "PartnerId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Adm_PartnerContact_SupplyId", + table: "T_Adm_PartnerContact", + column: "SupplyId"); + migrationBuilder.CreateIndex( name: "IX_T_Adm_Skill_SkillTypeId", table: "T_Adm_Skill", @@ -5282,6 +5793,36 @@ namespace Kurs.Platform.Migrations table: "T_Crd_QuestionOption", column: "QuestionId"); + migrationBuilder.CreateIndex( + name: "IX_T_Crm_Customer_AssignedEmployeeId", + table: "T_Crm_Customer", + column: "AssignedEmployeeId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Crm_Customer_CurrencyId", + table: "T_Crm_Customer", + column: "CurrencyId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Crm_Customer_CustomerSegmentId", + table: "T_Crm_Customer", + column: "CustomerSegmentId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Crm_Customer_CustomerTypeId", + table: "T_Crm_Customer", + column: "CustomerTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Crm_Customer_PaymentTermId", + table: "T_Crm_Customer", + column: "PaymentTermId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Crm_Customer_SectorId", + table: "T_Crm_Customer", + column: "SectorId"); + migrationBuilder.CreateIndex( name: "IX_T_Hr_CostCenter_DepartmentId", table: "T_Hr_CostCenter", @@ -5539,6 +6080,60 @@ namespace Kurs.Platform.Migrations table: "T_Scp_MaterialGroup", column: "ParentGroupId"); + migrationBuilder.CreateIndex( + name: "IX_T_Scp_Supply_CurrencyId", + table: "T_Scp_Supply", + column: "CurrencyId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Scp_Supply_PaymentTermId", + table: "T_Scp_Supply", + column: "PaymentTermId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Scp_Supply_SectorId", + table: "T_Scp_Supply", + column: "SectorId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Scp_Supply_SupplierTypeId", + table: "T_Scp_Supply", + column: "SupplierTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Scp_Supply_SupplyCardTypeId", + table: "T_Scp_Supply", + column: "SupplyCardTypeId"); + + migrationBuilder.AddForeignKey( + name: "FK_T_Adm_PartnerBank_T_Crm_Customer_CustomerId", + table: "T_Adm_PartnerBank", + column: "CustomerId", + principalTable: "T_Crm_Customer", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_T_Adm_PartnerCertificate_T_Crm_Customer_CustomerId", + table: "T_Adm_PartnerCertificate", + column: "CustomerId", + principalTable: "T_Crm_Customer", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_T_Adm_PartnerContact_T_Crm_Customer_CustomerId", + table: "T_Adm_PartnerContact", + column: "CustomerId", + principalTable: "T_Crm_Customer", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_T_Crm_Customer_T_Hr_Employee_AssignedEmployeeId", + table: "T_Crm_Customer", + column: "AssignedEmployeeId", + principalTable: "T_Hr_Employee", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( name: "FK_T_Hr_CostCenter_T_Hr_Department_DepartmentId", table: "T_Hr_CostCenter", @@ -5570,16 +6165,16 @@ namespace Kurs.Platform.Migrations table: "T_Acc_BankAccount"); migrationBuilder.DropForeignKey( - name: "FK_T_Hr_CostCenter_T_Hr_Department_DepartmentId", + name: "FK_T_Hr_CostCenter_T_Hr_Employee_ResponsibleEmployeeId", table: "T_Hr_CostCenter"); migrationBuilder.DropForeignKey( - name: "FK_T_Hr_Employee_T_Hr_Department_DepartmentId", - table: "T_Hr_Employee"); + name: "FK_T_Hr_Department_T_Hr_Employee_ManagerId", + table: "T_Hr_Department"); migrationBuilder.DropForeignKey( - name: "FK_T_Hr_JobPosition_T_Hr_Department_DepartmentId", - table: "T_Hr_JobPosition"); + name: "FK_T_Hr_CostCenter_T_Hr_Department_DepartmentId", + table: "T_Hr_CostCenter"); migrationBuilder.DropTable( name: "AbpAuditLogActions"); @@ -5701,9 +6296,6 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "P_Sas_ContactTitle"); - migrationBuilder.DropTable( - name: "P_Sas_Currency"); - migrationBuilder.DropTable( name: "P_Sas_DataSource"); @@ -5761,6 +6353,15 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "T_Adm_OrderItem"); + migrationBuilder.DropTable( + name: "T_Adm_PartnerBank"); + + migrationBuilder.DropTable( + name: "T_Adm_PartnerCertificate"); + + migrationBuilder.DropTable( + name: "T_Adm_PartnerContact"); + migrationBuilder.DropTable( name: "T_Adm_PaymentMethod"); @@ -5920,9 +6521,6 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "T_Sas_ReportParameter"); - migrationBuilder.DropTable( - name: "T_Sas_Sector"); - migrationBuilder.DropTable( name: "T_Scp_MaterialGroup"); @@ -5980,6 +6578,15 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "T_Adm_Order"); + migrationBuilder.DropTable( + name: "Partners"); + + migrationBuilder.DropTable( + name: "T_Crm_Customer"); + + migrationBuilder.DropTable( + name: "T_Scp_Supply"); + migrationBuilder.DropTable( name: "T_Adm_SkillType"); @@ -6040,6 +6647,27 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "P_Sas_ListForm"); + migrationBuilder.DropTable( + name: "T_Crm_CustomerSegment"); + + migrationBuilder.DropTable( + name: "T_Crm_CustomerType"); + + migrationBuilder.DropTable( + name: "P_Sas_Currency"); + + migrationBuilder.DropTable( + name: "T_Sas_Sector"); + + migrationBuilder.DropTable( + name: "T_Scp_PaymentTerm"); + + migrationBuilder.DropTable( + name: "T_Scp_SupplyCardType"); + + migrationBuilder.DropTable( + name: "T_Scp_SupplyType"); + migrationBuilder.DropTable( name: "T_Crd_QuestionPool"); @@ -6064,12 +6692,6 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "T_Acc_Bank"); - migrationBuilder.DropTable( - name: "T_Hr_Department"); - - migrationBuilder.DropTable( - name: "T_Hr_CostCenter"); - migrationBuilder.DropTable( name: "T_Hr_Employee"); @@ -6084,6 +6706,12 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "T_Hr_JobPosition"); + + migrationBuilder.DropTable( + name: "T_Hr_Department"); + + migrationBuilder.DropTable( + name: "T_Hr_CostCenter"); } } } diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index a547aab1..d270b2de 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -3044,6 +3044,296 @@ namespace Kurs.Platform.Migrations b.ToTable("T_Sas_CustomEntityField", (string)null); }); + modelBuilder.Entity("Kurs.Platform.Entities.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Address1") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Address2") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("AssignedEmployeeId") + .HasColumnType("uniqueidentifier"); + + b.Property("AverageOrderValue") + .ValueGeneratedOnAdd() + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("City") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Country") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CreditLimit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CurrencyId") + .HasColumnType("uniqueidentifier"); + + b.Property("CustomerSegmentId") + .HasColumnType("uniqueidentifier"); + + b.Property("CustomerTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("District") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Email") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Fax") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LastOrderDate") + .HasColumnType("datetime2"); + + b.Property("LifetimeValue") + .ValueGeneratedOnAdd() + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("Mobile") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PartyType") + .HasColumnType("int"); + + b.Property("PaymentTermId") + .HasColumnType("uniqueidentifier"); + + b.Property("Phone") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("PostalCode") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("SectorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Street") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TaxNumber") + .HasColumnType("bigint"); + + b.Property("TaxOffice") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TeamCode") + .HasMaxLength(95) + .HasColumnType("nvarchar(95)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TotalRevenue") + .ValueGeneratedOnAdd() + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("Website") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedEmployeeId"); + + b.HasIndex("CurrencyId"); + + b.HasIndex("CustomerSegmentId"); + + b.HasIndex("CustomerTypeId"); + + b.HasIndex("PaymentTermId"); + + b.HasIndex("SectorId"); + + b.ToTable("T_Crm_Customer", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.CustomerSegment", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("T_Crm_CustomerSegment", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.CustomerType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("T_Crm_CustomerType", (string)null); + }); + modelBuilder.Entity("Kurs.Platform.Entities.DataSource", b => { b.Property("Id") @@ -6131,6 +6421,399 @@ namespace Kurs.Platform.Migrations b.ToTable("T_Hr_Overtime", (string)null); }); + modelBuilder.Entity("Kurs.Platform.Entities.Partner", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Address1") + .HasColumnType("nvarchar(max)"); + + b.Property("Address2") + .HasColumnType("nvarchar(max)"); + + b.Property("City") + .HasColumnType("nvarchar(max)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreditLimit") + .HasColumnType("decimal(18,2)"); + + b.Property("CurrencyId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("District") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Fax") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastOrderDate") + .HasColumnType("datetime2"); + + b.Property("Mobile") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("PaymentTermId") + .HasColumnType("uniqueidentifier"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("PostalCode") + .HasColumnType("nvarchar(max)"); + + b.Property("SectorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Street") + .HasColumnType("nvarchar(max)"); + + b.Property("TaxNumber") + .HasColumnType("bigint"); + + b.Property("TaxOffice") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Website") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CurrencyId"); + + b.HasIndex("PaymentTermId"); + + b.HasIndex("SectorId"); + + b.ToTable("Partners"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerBank", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AccountNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("AccountOwner") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AccountType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Balance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("BankName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BranchName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CurrencyId") + .HasColumnType("uniqueidentifier"); + + b.Property("CustomerId") + .HasColumnType("uniqueidentifier"); + + b.Property("DailyTransferLimit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Iban") + .IsRequired() + .HasMaxLength(34) + .HasColumnType("nvarchar(34)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDefault") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("OverdraftLimit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("PartnerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SupplyId") + .HasColumnType("uniqueidentifier"); + + b.Property("SwiftCode") + .HasMaxLength(11) + .HasColumnType("nvarchar(11)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("CurrencyId"); + + b.HasIndex("CustomerId"); + + b.HasIndex("PartnerId"); + + b.HasIndex("SupplyId"); + + b.ToTable("T_Adm_PartnerBank", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerCertificate", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Certificate") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExpiryDate") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IssueDate") + .HasColumnType("datetime2"); + + b.Property("Issuer") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PartnerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SupplyId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("PartnerId"); + + b.HasIndex("SupplyId"); + + b.ToTable("T_Adm_PartnerCertificate", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerContact", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Department") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Email") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("FullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsPrimary") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Mobile") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("PartnerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Phone") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("SupplyId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("PartnerId"); + + b.HasIndex("SupplyId"); + + b.ToTable("T_Adm_PartnerContact", (string)null); + }); + modelBuilder.Entity("Kurs.Platform.Entities.PaymentMethod", b => { b.Property("Id") @@ -6188,6 +6871,55 @@ namespace Kurs.Platform.Migrations b.ToTable("T_Adm_PaymentMethod", (string)null); }); + modelBuilder.Entity("Kurs.Platform.Entities.PaymentTerm", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("T_Scp_PaymentTerm", (string)null); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Payroll", b => { b.Property("Id") @@ -8434,6 +9166,265 @@ namespace Kurs.Platform.Migrations b.ToTable("T_Prt_Source", (string)null); }); + modelBuilder.Entity("Kurs.Platform.Entities.Supply", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Address1") + .HasColumnType("nvarchar(max)"); + + b.Property("Address2") + .HasColumnType("nvarchar(max)"); + + b.Property("CardNumber") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("City") + .HasColumnType("nvarchar(max)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreditLimit") + .HasColumnType("decimal(18,2)"); + + b.Property("CurrencyId") + .HasColumnType("uniqueidentifier"); + + b.Property("CurrentBalance") + .ValueGeneratedOnAdd() + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("DiscountRate") + .ValueGeneratedOnAdd() + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("District") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Fax") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastOrderDate") + .HasColumnType("datetime2"); + + b.Property("Mobile") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("PartyType") + .HasColumnType("int"); + + b.Property("PaymentTermId") + .HasColumnType("uniqueidentifier"); + + b.Property("PerformanceMetricsJson") + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("PostalCode") + .HasColumnType("nvarchar(max)"); + + b.Property("SectorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Street") + .HasColumnType("nvarchar(max)"); + + b.Property("SupplierTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("SupplyCardTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("TaxNumber") + .HasColumnType("bigint"); + + b.Property("TaxOffice") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ValidFrom") + .HasColumnType("datetime2"); + + b.Property("ValidTo") + .HasColumnType("datetime2"); + + b.Property("Website") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CurrencyId"); + + b.HasIndex("PaymentTermId"); + + b.HasIndex("SectorId"); + + b.HasIndex("SupplierTypeId"); + + b.HasIndex("SupplyCardTypeId"); + + b.ToTable("T_Scp_Supply", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SupplyCardType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("T_Scp_SupplyCardType", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SupplyType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("T_Scp_SupplyType", (string)null); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Survey", b => { b.Property("Id") @@ -11754,6 +12745,49 @@ namespace Kurs.Platform.Migrations b.Navigation("Entity"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Customer", b => + { + b.HasOne("Kurs.Platform.Entities.Employee", "AssignedEmployee") + .WithMany() + .HasForeignKey("AssignedEmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Kurs.Platform.Entities.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId"); + + b.HasOne("Kurs.Platform.Entities.CustomerSegment", "CustomerSegment") + .WithMany("Customers") + .HasForeignKey("CustomerSegmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Kurs.Platform.Entities.CustomerType", "CustomerType") + .WithMany("Customers") + .HasForeignKey("CustomerTypeId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Kurs.Platform.Entities.PaymentTerm", "PaymentTerm") + .WithMany() + .HasForeignKey("PaymentTermId"); + + b.HasOne("Kurs.Platform.Entities.Sector", "Sector") + .WithMany() + .HasForeignKey("SectorId"); + + b.Navigation("AssignedEmployee"); + + b.Navigation("Currency"); + + b.Navigation("CustomerSegment"); + + b.Navigation("CustomerType"); + + b.Navigation("PaymentTerm"); + + b.Navigation("Sector"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Department", b => { b.HasOne("Kurs.Platform.Entities.CostCenter", "CostCenter") @@ -11993,6 +13027,90 @@ namespace Kurs.Platform.Migrations b.Navigation("Employee"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Partner", b => + { + b.HasOne("Kurs.Platform.Entities.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId"); + + b.HasOne("Kurs.Platform.Entities.PaymentTerm", "PaymentTerm") + .WithMany() + .HasForeignKey("PaymentTermId"); + + b.HasOne("Kurs.Platform.Entities.Sector", "Sector") + .WithMany() + .HasForeignKey("SectorId"); + + b.Navigation("Currency"); + + b.Navigation("PaymentTerm"); + + b.Navigation("Sector"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerBank", b => + { + b.HasOne("Kurs.Platform.Entities.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId"); + + b.HasOne("Kurs.Platform.Entities.Customer", null) + .WithMany("Banks") + .HasForeignKey("CustomerId"); + + b.HasOne("Kurs.Platform.Entities.Partner", "Partner") + .WithMany("Banks") + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Kurs.Platform.Entities.Supply", null) + .WithMany("Banks") + .HasForeignKey("SupplyId"); + + b.Navigation("Currency"); + + b.Navigation("Partner"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerCertificate", b => + { + b.HasOne("Kurs.Platform.Entities.Customer", null) + .WithMany("Certificates") + .HasForeignKey("CustomerId"); + + b.HasOne("Kurs.Platform.Entities.Partner", "Partner") + .WithMany("Certificates") + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Kurs.Platform.Entities.Supply", null) + .WithMany("Certificates") + .HasForeignKey("SupplyId"); + + b.Navigation("Partner"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.PartnerContact", b => + { + b.HasOne("Kurs.Platform.Entities.Customer", null) + .WithMany("Contacts") + .HasForeignKey("CustomerId"); + + b.HasOne("Kurs.Platform.Entities.Partner", "Partner") + .WithMany("Contacts") + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Kurs.Platform.Entities.Supply", null) + .WithMany("Contacts") + .HasForeignKey("SupplyId"); + + b.Navigation("Partner"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.PayrollItem", b => { b.HasOne("Kurs.Platform.Entities.Payroll", "Payroll") @@ -12206,6 +13324,41 @@ namespace Kurs.Platform.Migrations b.Navigation("Employee"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Supply", b => + { + b.HasOne("Kurs.Platform.Entities.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId"); + + b.HasOne("Kurs.Platform.Entities.PaymentTerm", "PaymentTerm") + .WithMany() + .HasForeignKey("PaymentTermId"); + + b.HasOne("Kurs.Platform.Entities.Sector", "Sector") + .WithMany() + .HasForeignKey("SectorId"); + + b.HasOne("Kurs.Platform.Entities.SupplyType", "SupplierType") + .WithMany("Supplies") + .HasForeignKey("SupplierTypeId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Kurs.Platform.Entities.SupplyCardType", "SupplyCardType") + .WithMany("Supplies") + .HasForeignKey("SupplyCardTypeId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Currency"); + + b.Navigation("PaymentTerm"); + + b.Navigation("Sector"); + + b.Navigation("SupplierType"); + + b.Navigation("SupplyCardType"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.SurveyAnswer", b => { b.HasOne("Kurs.Platform.Entities.SurveyQuestion", "Question") @@ -12518,6 +13671,25 @@ namespace Kurs.Platform.Migrations b.Navigation("Fields"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Customer", b => + { + b.Navigation("Banks"); + + b.Navigation("Certificates"); + + b.Navigation("Contacts"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.CustomerSegment", b => + { + b.Navigation("Customers"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.CustomerType", b => + { + b.Navigation("Customers"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Department", b => { b.Navigation("Performans360s"); @@ -12571,6 +13743,15 @@ namespace Kurs.Platform.Migrations b.Navigation("Items"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Partner", b => + { + b.Navigation("Banks"); + + b.Navigation("Certificates"); + + b.Navigation("Contacts"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Payroll", b => { b.Navigation("Items"); @@ -12633,6 +13814,25 @@ namespace Kurs.Platform.Migrations b.Navigation("Media"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Supply", b => + { + b.Navigation("Banks"); + + b.Navigation("Certificates"); + + b.Navigation("Contacts"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SupplyCardType", b => + { + b.Navigation("Supplies"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SupplyType", b => + { + b.Navigation("Supplies"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Survey", b => { b.Navigation("Questions"); diff --git a/ui/src/mocks/mockBusinessParties.ts b/ui/src/mocks/mockBusinessParties.ts index 92c605a9..d12b7493 100644 --- a/ui/src/mocks/mockBusinessParties.ts +++ b/ui/src/mocks/mockBusinessParties.ts @@ -7,7 +7,7 @@ export const mockBusinessParties: BusinessParty[] = [ { id: '1', code: 'SUP001', - supplierType: SupplierTypeEnum.Manufacturer, + partyType: PartyType.Supplier, name: 'ABC Malzeme Ltd.', primaryContact: { id: '2', @@ -92,9 +92,9 @@ export const mockBusinessParties: BusinessParty[] = [ lastModificationTime: new Date(), }, ], + supplierType: SupplierTypeEnum.Manufacturer, creationTime: new Date(), lastModificationTime: new Date(), - partyType: PartyType.Supplier, }, { id: '2', @@ -404,8 +404,8 @@ export const mockBusinessParties: BusinessParty[] = [ }, taxNumber: '0987654321', registrationNumber: 'REG-002', - creditLimit: 500000, paymentTerms: PaymentTerms.Net60, + creditLimit: 500000, currency: 'TRY', status: BusinessPartyStatusEnum.Active, customerSegment: CustomerSegmentEnum.SMB, diff --git a/ui/src/types/crm.ts b/ui/src/types/crm.ts index 78340ba0..a6d5da28 100644 --- a/ui/src/types/crm.ts +++ b/ui/src/types/crm.ts @@ -1,5 +1,5 @@ +import { EmployeeDto } from '@/proxy/intranet/models' import { Address, BusinessParty, Contact, PaymentTerms, PriorityEnum } from './common' -import { EmployeeDto } from './hr' import { MmDelivery, MmMaterial, MmUnit } from './mm' export interface CrmSalesOrder {