From b3ba87a8fa97b04f67bda14e3108a4f6f66eaea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Thu, 2 Oct 2025 13:37:27 +0300 Subject: [PATCH] Bank ve Bank Account Seeder --- .../Seeds/ListFormsSeeder.cs | 437 ++++++++++++++++++ .../Seeds/SeederData.json | 12 +- .../PlatformConsts.cs | 1 + .../EntityFrameworkCore/PlatformDbContext.cs | 2 +- ....cs => 20251002102738_Initial.Designer.cs} | 6 +- ...3_Initial.cs => 20251002102738_Initial.cs} | 2 +- .../PlatformDbContextModelSnapshot.cs | 4 +- 7 files changed, 446 insertions(+), 18 deletions(-) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251002081543_Initial.Designer.cs => 20251002102738_Initial.Designer.cs} (99%) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251002081543_Initial.cs => 20251002102738_Initial.cs} (99%) diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs index 55432df3..95a35da7 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs @@ -680,6 +680,434 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency } #endregion + #region Bank + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormBank)) + { + var formBank = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.Form, + IsSubForm = false, + LayoutJson = JsonSerializer.Serialize(new LayoutDto() + { + Grid = true, + Card = true, + Pivot = true, + Chart = true, + DefaultLayout = "grid", + CardLayoutColumn = 4 + }), + SubFormsJson = JsonSerializer.Serialize(new List() { + new { + TabTitle = "Bank Accounts", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.BankAccount, + Relation = new List() { + new { + ParentFieldName = "Id", + ChildFieldName = "BankId" + } + } + }, + }), + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Forms.FormBank, + Name = AppCodes.Definitions.Bank, + Title = AppCodes.Definitions.Bank, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Bank, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = SelectCommandByTableName("Bank"), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = "\"IsDeleted\" = 'false'", + SortMode = GridOptions.SortModeSingle, + PermissionJson = JsonSerializer.Serialize(new PermissionCrudDto + { + C = AppCodes.Definitions.Bank + ".Create", + R = AppCodes.Definitions.Bank, + U = AppCodes.Definitions.Bank + ".Update", + D = AppCodes.Definitions.Bank + ".Delete", + E = AppCodes.Definitions.Bank + ".Export", + I = AppCodes.Definitions.Bank + ".Import" + }), + DeleteCommand = $"UPDATE \"{DbTablePrefix}Bank\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { + FieldName = "DeleterId", + FieldDbType = DbType.Guid, + Value = "@USERID", + CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { + FieldName = "Id", + FieldDbType = DbType.Guid, + Value = "@ID", + CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + ConfirmDelete = true, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "IdentifierCode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox}, + new EditingFormItemDto { Order = 3, DataField = "AddressLine1", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "AddressLine2", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "Country", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order = 6, DataField = "City", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order = 7, DataField = "District", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order = 8, DataField = "PostalCode", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 9, DataField = "Phone", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 10, DataField = "Email", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { + FieldName = "CreationTime", + FieldDbType = DbType.DateTime, + Value = "@NOW", + CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { + FieldName = "CreatorId", + FieldDbType = DbType.Guid, + Value = "@USERID", + CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { + FieldName = "IsDeleted", + FieldDbType = DbType.Boolean, + Value = "false", + CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + #region Bank Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = formBank.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 1, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required)} + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Definitions.Bank + ".Create", + R = AppCodes.Definitions.Bank, + U = AppCodes.Definitions.Bank + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formBank.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "IdentifierCode", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required)} + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Definitions.Bank + ".Create", + R = AppCodes.Definitions.Bank, + U = AppCodes.Definitions.Bank + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formBank.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "AddressLine1", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Definitions.Bank + ".Create", + R = AppCodes.Definitions.Bank, + U = AppCodes.Definitions.Bank + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formBank.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "AddressLine2", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Definitions.Bank + ".Create", + R = AppCodes.Definitions.Bank, + U = AppCodes.Definitions.Bank + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formBank.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Country", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = $"SELECT \"{DbTablePrefix}Country\".\"Code\" AS \"Key\", \"{DbTablePrefix}Country\".\"Name\" as \"Name\" FROM \"{DbTablePrefix}Country\" ORDER BY \"{DbTablePrefix}Country\".\"Name\"", + CascadeEmptyFields = "City,District,Street" + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Definitions.Bank + ".Create", + R = AppCodes.Definitions.Bank, + U = AppCodes.Definitions.Bank + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formBank.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "City", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = $"SELECT \"{DbTablePrefix}City\".\"Code\" AS \"Key\", \"{DbTablePrefix}City\".\"Name\" as \"Name\" FROM \"{DbTablePrefix}City\" WHERE \"PCity\".\"CountryCode\" = @param0 OR @param0 IS NULL ORDER BY \"{DbTablePrefix}City\".\"Name\"", + CascadeRelationField = "Country", + CascadeFilterOperator="=", + CascadeParentFields = "Country", + CascadeEmptyFields = "District,Street" + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Definitions.Bank + ".Create", + R = AppCodes.Definitions.Bank, + U = AppCodes.Definitions.Bank + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formBank.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "District", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = $"SELECT \"{DbTablePrefix}District\".\"Name\" AS \"Key\", \"{DbTablePrefix}District\".\"Name\" as \"Name\" FROM \"{DbTablePrefix}District\" WHERE (\"{DbTablePrefix}District\".\"CountryCode\" = @param0 OR @param0 IS NULL) AND (\"{DbTablePrefix}District\".\"CityCode\" = @param1 OR @param1 IS NULL) GROUP BY \"{DbTablePrefix}District\".\"Name\" ORDER BY \"{DbTablePrefix}District\".\"Name\"", + CascadeRelationField = "City", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City", + CascadeEmptyFields = "Street", + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Definitions.Bank + ".Create", + R = AppCodes.Definitions.Bank, + U = AppCodes.Definitions.Bank + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formBank.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PostalCode", + Width = 150, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Definitions.Bank + ".Create", + R = AppCodes.Definitions.Bank, + U = AppCodes.Definitions.Bank + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formBank.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone", + Width = 150, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Definitions.Bank + ".Create", + R = AppCodes.Definitions.Bank, + U = AppCodes.Definitions.Bank + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formBank.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 150, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Definitions.Bank + ".Create", + R = AppCodes.Definitions.Bank, + U = AppCodes.Definitions.Bank + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + }); + #endregion + } + #endregion + #endregion #region List @@ -12286,6 +12714,15 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Manage", + Text ="Manage", + UrlTarget="_blank", + AuthName = AppCodes.Definitions.Bank + ".Update", + Url=$"/admin/form/{ListFormCodes.Forms.FormBank}/@Id" + }, + }), } ); diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json b/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json index 29197d25..472d6446 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json @@ -6601,17 +6601,7 @@ "RequiredPermissionName": "App.Definitions.Bank", "IsDisabled": false }, - { - "ParentCode": "App.Definitions", - "Code": "App.Definitions.BankAccount", - "DisplayName": "App.Definitions.BankAccount", - "Order": 10, - "Url": "/admin/list/list-bankaccount", - "Icon": "FaMoneyCheckAlt", - "RequiredPermissionName": "App.Definitions.BankAccount", - "IsDisabled": false - }, - + { "ParentCode": null, "Code": "App.Participant", diff --git a/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs b/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs index bcd6027a..5d2b7725 100644 --- a/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs +++ b/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs @@ -386,6 +386,7 @@ public static class PlatformConsts public const string FormLanguage = "form-language"; public const string FormUomCategory = "form-uomcategory"; public const string FormSkillType = "form-skilltype"; + public const string FormBank = "form-bank"; } public static class Charts diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 8e828252..add3e0df 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -338,7 +338,7 @@ public class PlatformDbContext : b.ToTable(PlatformConsts.DbTablePrefix + nameof(Bank), PlatformConsts.DbSchema); b.ConfigureByConvention(); - b.Property(x => x.Name).IsRequired().HasMaxLength(8); + b.Property(x => x.Name).IsRequired().HasMaxLength(128); }); builder.Entity(b => diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002081543_Initial.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002102738_Initial.Designer.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002081543_Initial.Designer.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002102738_Initial.Designer.cs index 674f6e84..19d14d75 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002081543_Initial.Designer.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002102738_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Kurs.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251002081543_Initial")] + [Migration("20251002102738_Initial")] partial class Initial { /// @@ -988,8 +988,8 @@ namespace Kurs.Platform.Migrations b.Property("Name") .IsRequired() - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Phone") .HasMaxLength(64) diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002081543_Initial.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002102738_Initial.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002081543_Initial.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002102738_Initial.cs index 806e970b..93c815df 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002081543_Initial.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251002102738_Initial.cs @@ -638,7 +638,7 @@ namespace Kurs.Platform.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), IdentifierCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), AddressLine1 = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), AddressLine2 = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 2506a2ab..9d416848 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -985,8 +985,8 @@ namespace Kurs.Platform.Migrations b.Property("Name") .IsRequired() - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Phone") .HasMaxLength(64)