Report Category Entity ve Seeder

This commit is contained in:
Sedat ÖZTÜRK 2025-08-15 16:01:24 +03:00
parent 104d92fbc8
commit c6e13b9216
20 changed files with 574 additions and 43 deletions

View file

@ -12,7 +12,7 @@ namespace Kurs.Platform.Reports
[Required]
public string HtmlContent { get; set; }
public string Category { get; set; }
public string CategoryName { get; set; }
public List<string> Tags { get; set; }
public List<CreateReportParameterDto> Parameters { get; set; }

View file

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Application.Dtos;
namespace Kurs.Platform.Reports
{
public class ReportCategoryDto : FullAuditedEntityDto<Guid>
{
public string Name { get; set; }
public string Description { get; set; }
public string Icon { get; set; }
public int TemplateCount { get; init; }
}
}

View file

@ -13,14 +13,14 @@ namespace Kurs.Platform.Reports
[Required]
public string HtmlContent { get; set; }
public string Category { get; set; }
public string CategoryName { get; set; }
public List<string> Tags { get; set; }
public List<ReportParameterDto> Parameters { get; set; }
public ReportTemplateDto()
{
Tags = new List<string>();
Parameters = new List<ReportParameterDto>();
Tags = [];
Parameters = [];
}
}
}

View file

@ -12,7 +12,7 @@ namespace Kurs.Platform.Reports
[Required]
public string HtmlContent { get; set; }
public string Category { get; set; }
public string CategoryName { get; set; }
public List<string> Tags { get; set; }
public List<UpdateReportParameterDto> Parameters { get; set; }

View file

@ -40,13 +40,13 @@ public class ReportAppService : PlatformAppService, IReportAppService
query = query.Where(x =>
x.Name.Contains(input.Filter) ||
x.Description.Contains(input.Filter) ||
x.Category.Contains(input.Filter)
x.CategoryName.Contains(input.Filter)
);
}
if (!string.IsNullOrWhiteSpace(input.Category))
{
query = query.Where(x => x.Category == input.Category);
query = query.Where(x => x.CategoryName == input.Category);
}
// Toplam kayıt sayısı
@ -85,7 +85,7 @@ public class ReportAppService : PlatformAppService, IReportAppService
input.Name,
input.Description,
input.HtmlContent,
input.Category ?? "Genel")
input.CategoryName)
{
Tags = JsonSerializer.Serialize(input.Tags)
};
@ -120,7 +120,7 @@ public class ReportAppService : PlatformAppService, IReportAppService
template.Name = input.Name;
template.Description = input.Description;
template.HtmlContent = input.HtmlContent;
template.Category = input.Category ?? "Genel";
template.CategoryName = input.CategoryName;
template.Tags = JsonSerializer.Serialize(input.Tags);
await _reportTemplateRepository.UpdateAsync(template);
@ -262,7 +262,7 @@ public class ReportAppService : PlatformAppService, IReportAppService
Name = template.Name,
Description = template.Description,
HtmlContent = template.HtmlContent,
Category = template.Category,
CategoryName = template.CategoryName,
CreationTime = template.CreationTime,
LastModificationTime = template.LastModificationTime,
CreatorId = template.CreatorId,

View file

@ -43,6 +43,9 @@ namespace Kurs.Platform.Reports
.ForMember(dest => dest.TemplateName, opt => opt.Ignore())
.ForMember(dest => dest.GeneratedContent, opt => opt.Ignore())
.ForMember(dest => dest.GeneratedAt, opt => opt.Ignore());
CreateMap<ReportCategory, ReportCategoryDto>();
}
private static List<string> ConvertTagsFromJson(string tags)

View file

@ -13089,6 +13089,191 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
}
#endregion
#region Report Categories
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ReportCategory))
{
var listFormReportCatory = await _listFormRepository.InsertAsync(
new ListForm
{
CultureName = LanguageCodes.En,
ListFormCode = ListFormCodes.Lists.ReportCategory,
Name = AppCodes.Reports.Categories,
Title = AppCodes.Reports.Categories,
DataSourceCode = SeedConsts.DataSources.DefaultCode,
IsTenant = false,
IsBranch = false,
IsOrganizationUnit = false,
Description = AppCodes.Reports.Categories,
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = SelectCommandByTableName("ReportCategory"),
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.Int32,
SortMode = GridOptions.SortModeSingle,
FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }),
HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }),
SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }),
GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }),
SelectionJson = JsonSerializer.Serialize(new SelectionDto
{
Mode = GridOptions.SelectionModeSingle,
AllowSelectAll = false
}),
ColumnOptionJson = JsonSerializer.Serialize(new
{
ColumnFixingEnabled = true,
}),
PermissionJson = JsonSerializer.Serialize(new PermissionCrudDto
{
C = AppCodes.Reports.Default + ".Create",
R = AppCodes.Reports.Default,
U = AppCodes.Reports.Default + ".Update",
D = AppCodes.Reports.Default + ".Delete",
E = AppCodes.Reports.Default + ".Export",
I = AppCodes.Reports.Default + ".Import"
}),
PagerOptionJson = JsonSerializer.Serialize(new GridPagerOptionDto
{
Visible = true,
AllowedPageSizes = "10,20,50,100",
ShowPageSizeSelector = true,
ShowNavigationButtons = true,
ShowInfo = false,
InfoText = "Page {0} of {1} ({2} items)",
DisplayMode = GridColumnOptions.PagerDisplayModeAdaptive,
ScrollingMode = GridColumnOptions.ScrollingModeStandard,
LoadPanelEnabled = "auto",
LoadPanelText = "Loading..."
}),
EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto
{
Popup = new GridEditingPopupDto
{
Title = "Report Category Form",
Width = 500,
Height = 300
},
AllowDeleting = true,
AllowAdding = true,
AllowUpdating = true,
SendOnlyChangedFormValuesUpdate = false
}),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>
{
new()
{
Order = 1,
ColCount = 1,
ColSpan = 2,
ItemType = "group",
Items =
[
new EditingFormItemDto { Order = 1, DataField = "Id", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextArea },
new EditingFormItemDto { Order = 4, DataField = "Icon", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox },
]
}
})
});
#region Report Categories Fields
await _listFormFieldRepository.InsertManyAsync([
new()
{
ListFormCode = listFormReportCatory.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
ValidationRuleJson = JsonSerializer.Serialize(new[]
{
new ValidationRuleDto { Type = "required" }
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Reports.Default + ".Create",
R = AppCodes.Reports.Default,
U = AppCodes.Reports.Default + ".Update",
E = true,
Deny = false
})
},
new()
{
ListFormCode = listFormReportCatory.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Name",
Width = 300,
ListOrderNo = 2,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ValidationRuleJson = JsonSerializer.Serialize(new[]
{
new ValidationRuleDto { Type = "required" }
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Reports.Default + ".Create",
R = AppCodes.Reports.Default,
U = AppCodes.Reports.Default + ".Update",
E = true,
Deny = false
})
},
new()
{
ListFormCode = listFormReportCatory.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Description",
Width = 100,
ListOrderNo = 3,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Reports.Default + ".Create",
R = AppCodes.Reports.Default,
U = AppCodes.Reports.Default + ".Update",
E = true,
Deny = false
})
},
new()
{
ListFormCode = listFormReportCatory.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Icon",
Width = 100,
ListOrderNo = 4,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Reports.Default + ".Create",
R = AppCodes.Reports.Default,
U = AppCodes.Reports.Default + ".Update",
E = true,
Deny = false
})
},
]);
#endregion
}
#endregion
#endregion
}
}

View file

@ -60,7 +60,7 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
private readonly IRepository<PaymentMethod, String> _paymentMethodRepository;
private readonly IRepository<InstallmentOption, int> _installmentOptionRepository;
private readonly IRepository<CustomComponent, Guid> _customComponentRepository;
private readonly IRepository<ReportCategory, Guid> _reportCategoriesRepository;
public PlatformDataSeeder(
IRepository<Language, Guid> languages,
@ -96,7 +96,8 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
IRepository<Product, Guid> ProductRepository,
IRepository<PaymentMethod, String> PaymentMethodRepository,
IRepository<InstallmentOption, int> InstallmentOptionRepository,
IRepository<CustomComponent, Guid> CustomComponentRepository
IRepository<CustomComponent, Guid> CustomComponentRepository,
IRepository<ReportCategory, Guid> ReportCategoriesRepository
)
{
_languages = languages;
@ -133,6 +134,7 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
_paymentMethodRepository = PaymentMethodRepository;
_installmentOptionRepository = InstallmentOptionRepository;
_customComponentRepository = CustomComponentRepository;
_reportCategoriesRepository = ReportCategoriesRepository;
}
private static IConfigurationRoot BuildConfiguration()
@ -750,6 +752,20 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
JsonSerializer.Serialize(item.Dependencies)));
}
}
foreach (var item in items.ReportCategories)
{
var exists = await _reportCategoriesRepository.AnyAsync(x => x.Name == item.Name);
if (!exists)
{
await _reportCategoriesRepository.InsertAsync(new ReportCategory(
item.Id,
item.Name,
item.Description,
item.Icon));
}
}
}
}

View file

@ -25914,5 +25914,25 @@
"isActive": true,
"dependencies": ["AxiosListComponent"]
}
],
"ReportCategories": [
{
"id": "5f4d6c1f-b1e0-4f91-854c-1d59c25e7191",
"name": "Genel Raporlar",
"description": "Genel Şirket içi raporlar",
"icon": "📊"
},
{
"id": "5f4d6c1f-b1e0-4f91-854c-1d59c25e7192",
"name": "Taahhütnameler",
"description": "Kursiyeler ile ilgili taahhütname raporları",
"icon": "✍️"
},
{
"id": "5f4d6c1f-b1e0-4f91-854c-1d59c25e7193",
"name": "Sözleşmeler",
"description": "Tedarikçiler ile ilgili sözleşme raporları",
"icon": "📜"
}
]
}

View file

@ -43,6 +43,7 @@ public class SeederDto
public List<PaymentMethodSeedDto> PaymentMethods { get; set; }
public List<InstallmentOptionSeedDto> InstallmentOptions { get; set; }
public List<CustomComponentSeedDto> CustomComponents { get; set; }
public List<ReportCategorySeedDto> ReportCategories { get; set; }
}
public class ChartsSeedDto
@ -309,3 +310,11 @@ public class CustomComponentSeedDto
public bool IsActive { get; set; }
public List<string> Dependencies { get; set; } = new();
}
public class ReportCategorySeedDto
{
public Guid Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Icon { get; set; }
}

View file

@ -366,6 +366,7 @@ public static class PlatformConsts
public const string PaymentMethod = "list-paymentmethod";
public const string InstallmentOption = "list-installmentoption";
public const string PurchaseOrder = "list-purchaseorder";
public const string ReportCategory = "list-reportcategory";
public const string ListformField = "list-listformfield";
}

View file

@ -394,6 +394,12 @@ public static class SeedConsts
public const string InstallmentOptions = Default + ".InstallmentOptions";
public const string PurchaseOrders = Default + ".PurchaseOrders";
}
public static class Reports
{
public const string Default = Prefix.App + ".Reports";
public const string Categories = Default + ".Categories";
}
}
public static class DataSources

View file

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
namespace Kurs.Platform.Entities
{
public class ReportCategory : FullAuditedAggregateRoot<Guid>
{
[Required]
public string Name { get; set; }
public string Description { get; set; }
public string Icon { get; set; }
public ICollection<ReportTemplate> ReportTemplates { get; set; }
public ReportCategory()
{
}
public ReportCategory(
Guid id,
string name,
string description,
string icon = null
) : base(id)
{
Name = name;
Description = description;
Icon = icon;
}
}
}

View file

@ -13,10 +13,11 @@ namespace Kurs.Platform.Entities
[Required]
public string HtmlContent { get; set; }
public string Category { get; set; }
public string CategoryName { get; set; }
public string Tags { get; set; } // JSON string array
public virtual ICollection<ReportParameter> Parameters { get; set; }
public ReportCategory ReportCategory { get; set; }
public ICollection<ReportParameter> Parameters { get; set; }
public ReportTemplate()
{
@ -28,13 +29,13 @@ namespace Kurs.Platform.Entities
string name,
string description,
string htmlContent,
string category = "Genel"
string categoryName = "Genel"
) : base(id)
{
Name = name;
Description = description;
HtmlContent = htmlContent;
Category = category;
CategoryName = categoryName;
Parameters = new List<ReportParameter>();
}
}

View file

@ -81,13 +81,14 @@ public class PlatformDbContext :
public DbSet<Order> Orders { get; set; }
public DbSet<OrderItem> OrderItems { get; set; }
public DbSet<ListFormImport> ListFormImports { get; set; }
public DbSet<ListFormImportExecute> ListFormImportExecutes { get; set; }
// Reports Entities
public DbSet<ReportTemplate> ReportTemplates { get; set; }
public DbSet<ReportParameter> ReportParameters { get; set; }
public DbSet<ReportGenerated> GeneratedReports { get; set; }
public DbSet<ListFormImport> ListFormImports { get; set; }
public DbSet<ListFormImportExecute> ListFormImportExecutes { get; set; }
public DbSet<ReportGenerated> ReportGenerated { get; set; }
public DbSet<ReportCategory> ReportCategories { get; set; }
#region Entities from the modules
@ -692,6 +693,26 @@ public class PlatformDbContext :
});
// Reports Configuration
// Reports Configuration
builder.Entity<ReportCategory>(b =>
{
b.ToTable(PlatformConsts.DbTablePrefix + nameof(ReportCategory), PlatformConsts.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(256);
b.Property(x => x.Description).HasMaxLength(4000); // JSON string
b.Property(x => x.Icon).HasMaxLength(64);
// Primary key dışında Name de ilişki anahtarı olarak kullanılacaksa
b.HasIndex(x => x.Name).IsUnique();
b.HasMany(x => x.ReportTemplates) // Bir kategori birden çok template içerir
.WithOne(x => x.ReportCategory) // Template'in bir kategorisi vardır
.HasForeignKey(x => x.CategoryName) // Template tarafındaki FK property
.HasPrincipalKey(c => c.Name) // Category tarafındaki anahtar
.OnDelete(DeleteBehavior.SetNull); // Silindiğinde null bırak
});
builder.Entity<ReportTemplate>(b =>
{
b.ToTable(PlatformConsts.DbTablePrefix + nameof(ReportTemplate), PlatformConsts.DbSchema);
@ -700,13 +721,16 @@ public class PlatformDbContext :
b.Property(x => x.Name).IsRequired().HasMaxLength(256);
b.Property(x => x.Description).HasMaxLength(1000);
b.Property(x => x.HtmlContent).IsRequired();
b.Property(x => x.Category).HasMaxLength(100);
b.Property(x => x.CategoryName).HasMaxLength(100);
b.Property(x => x.Tags).HasMaxLength(2000);
b.HasMany(t => t.Parameters) // navigation üzerinden
.WithOne(p => p.ReportTemplate) // karşı navigation
.HasForeignKey(p => p.ReportTemplateId) // scalar FK property
.OnDelete(DeleteBehavior.Cascade);
// Burada CategoryName FK olacak
b.Property(x => x.CategoryName).HasMaxLength(256);
b.HasMany(t => t.Parameters)
.WithOne(p => p.ReportTemplate)
.HasForeignKey(p => p.ReportTemplateId)
.OnDelete(DeleteBehavior.Cascade);
});
builder.Entity<ReportParameter>(b =>

View file

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Kurs.Platform.Migrations
{
[DbContext(typeof(PlatformDbContext))]
[Migration("20250815115111_Reports")]
[Migration("20250815123946_Reports")]
partial class Reports
{
/// <inheritdoc />
@ -2886,6 +2886,74 @@ namespace Kurs.Platform.Migrations
b.ToTable("PProduct", (string)null);
});
modelBuilder.Entity("Kurs.Platform.Entities.ReportCategory", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(4000)
.HasColumnType("nvarchar(4000)");
b.Property<string>("ExtraProperties")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Icon")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("PReportCategory", (string)null);
});
modelBuilder.Entity("Kurs.Platform.Entities.ReportGenerated", b =>
{
b.Property<Guid>("Id")
@ -3017,8 +3085,9 @@ namespace Kurs.Platform.Migrations
b.Property<bool>("Required")
.HasColumnType("bit");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -3032,9 +3101,9 @@ namespace Kurs.Platform.Migrations
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Category")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("CategoryName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
@ -3097,6 +3166,8 @@ namespace Kurs.Platform.Migrations
b.HasKey("Id");
b.HasIndex("CategoryName");
b.ToTable("PReportTemplate", (string)null);
});
@ -6000,6 +6071,17 @@ namespace Kurs.Platform.Migrations
b.Navigation("ReportTemplate");
});
modelBuilder.Entity("Kurs.Platform.Entities.ReportTemplate", b =>
{
b.HasOne("Kurs.Platform.Entities.ReportCategory", "ReportCategory")
.WithMany("ReportTemplates")
.HasForeignKey("CategoryName")
.HasPrincipalKey("Name")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("ReportCategory");
});
modelBuilder.Entity("Kurs.Platform.Entities.Uom", b =>
{
b.HasOne("Kurs.Platform.Entities.UomCategory", "UomCategory")
@ -6227,6 +6309,11 @@ namespace Kurs.Platform.Migrations
b.Navigation("Fields");
});
modelBuilder.Entity("Kurs.Platform.Entities.ReportCategory", b =>
{
b.Navigation("ReportTemplates");
});
modelBuilder.Entity("Kurs.Platform.Entities.ReportTemplate", b =>
{
b.Navigation("Parameters");

View file

@ -11,6 +11,30 @@ namespace Kurs.Platform.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PReportCategory",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Description = table.Column<string>(type: "nvarchar(4000)", maxLength: 4000, nullable: true),
Icon = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PReportCategory", x => x.Id);
table.UniqueConstraint("AK_PReportCategory_Name", x => x.Name);
});
migrationBuilder.CreateTable(
name: "PReportTemplate",
columns: table => new
@ -19,7 +43,7 @@ namespace Kurs.Platform.Migrations
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
HtmlContent = table.Column<string>(type: "nvarchar(max)", nullable: false),
Category = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
CategoryName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
Tags = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
@ -34,6 +58,12 @@ namespace Kurs.Platform.Migrations
constraints: table =>
{
table.PrimaryKey("PK_PReportTemplate", x => x.Id);
table.ForeignKey(
name: "FK_PReportTemplate_PReportCategory_CategoryName",
column: x => x.CategoryName,
principalTable: "PReportCategory",
principalColumn: "Name",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
@ -75,7 +105,7 @@ namespace Kurs.Platform.Migrations
ReportTemplateId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
Placeholder = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Type = table.Column<int>(type: "int", nullable: false),
Type = table.Column<string>(type: "nvarchar(max)", nullable: false),
DefaultValue = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
Required = table.Column<bool>(type: "bit", nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
@ -98,6 +128,12 @@ namespace Kurs.Platform.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_PReportCategory_Name",
table: "PReportCategory",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_PReportGenerated_TemplateId",
table: "PReportGenerated",
@ -107,6 +143,11 @@ namespace Kurs.Platform.Migrations
name: "IX_PReportParameter_ReportTemplateId",
table: "PReportParameter",
column: "ReportTemplateId");
migrationBuilder.CreateIndex(
name: "IX_PReportTemplate_CategoryName",
table: "PReportTemplate",
column: "CategoryName");
}
/// <inheritdoc />
@ -120,6 +161,9 @@ namespace Kurs.Platform.Migrations
migrationBuilder.DropTable(
name: "PReportTemplate");
migrationBuilder.DropTable(
name: "PReportCategory");
}
}
}

View file

@ -2883,6 +2883,74 @@ namespace Kurs.Platform.Migrations
b.ToTable("PProduct", (string)null);
});
modelBuilder.Entity("Kurs.Platform.Entities.ReportCategory", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(4000)
.HasColumnType("nvarchar(4000)");
b.Property<string>("ExtraProperties")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Icon")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("PReportCategory", (string)null);
});
modelBuilder.Entity("Kurs.Platform.Entities.ReportGenerated", b =>
{
b.Property<Guid>("Id")
@ -3014,8 +3082,9 @@ namespace Kurs.Platform.Migrations
b.Property<bool>("Required")
.HasColumnType("bit");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -3029,9 +3098,9 @@ namespace Kurs.Platform.Migrations
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Category")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("CategoryName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
@ -3094,6 +3163,8 @@ namespace Kurs.Platform.Migrations
b.HasKey("Id");
b.HasIndex("CategoryName");
b.ToTable("PReportTemplate", (string)null);
});
@ -5997,6 +6068,17 @@ namespace Kurs.Platform.Migrations
b.Navigation("ReportTemplate");
});
modelBuilder.Entity("Kurs.Platform.Entities.ReportTemplate", b =>
{
b.HasOne("Kurs.Platform.Entities.ReportCategory", "ReportCategory")
.WithMany("ReportTemplates")
.HasForeignKey("CategoryName")
.HasPrincipalKey("Name")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("ReportCategory");
});
modelBuilder.Entity("Kurs.Platform.Entities.Uom", b =>
{
b.HasOne("Kurs.Platform.Entities.UomCategory", "UomCategory")
@ -6224,6 +6306,11 @@ namespace Kurs.Platform.Migrations
b.Navigation("Fields");
});
modelBuilder.Entity("Kurs.Platform.Entities.ReportCategory", b =>
{
b.Navigation("ReportTemplates");
});
modelBuilder.Entity("Kurs.Platform.Entities.ReportTemplate", b =>
{
b.Navigation("Parameters");

View file

@ -20,7 +20,7 @@ export const Dashboard: React.FC = () => {
const [selectedCategory, setSelectedCategory] = useState('Tümü')
const categories = useMemo(() => {
const cats = ['Tümü', ...new Set(templates.map((t) => t.category))]
const cats = ['Tümü', ...new Set(templates.map((t) => t.categoryName))]
return cats
}, [templates])
@ -31,7 +31,8 @@ export const Dashboard: React.FC = () => {
template.description?.toLowerCase().includes(searchQuery.toLowerCase()) ||
template.tags.some((tag: any) => tag.toLowerCase().includes(searchQuery.toLowerCase()))
const matchesCategory = selectedCategory === 'Tümü' || template.category === selectedCategory
const matchesCategory =
selectedCategory === 'Tümü' || template.categoryName === selectedCategory
return matchesSearch && matchesCategory
})

View file

@ -16,7 +16,7 @@ export interface ReportTemplateDto {
name: string
description?: string
htmlContent: string
category?: string
categoryName?: string
tags: string[]
parameters: ReportParameterDto[]
@ -62,7 +62,7 @@ export interface CreateReportTemplateDto {
name: string
description?: string
htmlContent: string
category?: string
categoryName?: string
tags?: string[]
parameters: CreateReportParameterDto[]
}
@ -71,7 +71,7 @@ export interface UpdateReportTemplateDto {
name: string
description?: string
htmlContent: string
category?: string
categoryName?: string
tags?: string[]
parameters: UpdateReportParameterDto[]
}