Report App Service2

This commit is contained in:
Sedat ÖZTÜRK 2025-08-15 15:21:22 +03:00
parent 8d3f39a2e9
commit 104d92fbc8
12 changed files with 16 additions and 113 deletions

View file

@ -7,46 +7,30 @@ namespace Kurs.Platform.Reports
public class CreateReportTemplateDto public class CreateReportTemplateDto
{ {
[Required] [Required]
[StringLength(256)]
public string Name { get; set; } public string Name { get; set; }
[StringLength(1000)]
public string Description { get; set; } public string Description { get; set; }
[Required] [Required]
public string HtmlContent { get; set; } public string HtmlContent { get; set; }
[StringLength(100)]
public string Category { get; set; } public string Category { get; set; }
public List<string> Tags { get; set; } public List<string> Tags { get; set; }
public List<CreateReportParameterDto> Parameters { get; set; } public List<CreateReportParameterDto> Parameters { get; set; }
public CreateReportTemplateDto() public CreateReportTemplateDto()
{ {
Tags = new List<string>(); Tags = [];
Parameters = new List<CreateReportParameterDto>(); Parameters = [];
} }
} }
public class CreateReportParameterDto public class CreateReportParameterDto
{ {
[Required] [Required]
[StringLength(100)]
public string Name { get; set; } public string Name { get; set; }
[StringLength(200)]
public string Placeholder { get; set; } public string Placeholder { get; set; }
public string Type { get; set; }
public ReportParameterType Type { get; set; }
[StringLength(500)]
public string DefaultValue { get; set; } public string DefaultValue { get; set; }
public bool Required { get; set; } public bool Required { get; set; }
[StringLength(1000)]
public string Description { get; set; } public string Description { get; set; }
} }
} }

View file

@ -13,7 +13,7 @@ namespace Kurs.Platform.Reports
public GenerateReportDto() public GenerateReportDto()
{ {
Parameters = new Dictionary<string, string>(); Parameters = [];
} }
} }
} }

View file

@ -10,21 +10,17 @@ namespace Kurs.Platform.Reports
public Guid? TemplateId { get; set; } public Guid? TemplateId { get; set; }
[Required] [Required]
[StringLength(256)]
public string TemplateName { get; set; } public string TemplateName { get; set; }
[Required] [Required]
public string GeneratedContent { get; set; } public string GeneratedContent { get; set; }
public Dictionary<string, string> Parameters { get; set; } public Dictionary<string, string> Parameters { get; set; }
public DateTime GeneratedAt { get; set; } public DateTime GeneratedAt { get; set; }
public ReportTemplateDto Template { get; set; } public ReportTemplateDto Template { get; set; }
public GeneratedReportDto() public GeneratedReportDto()
{ {
Parameters = new Dictionary<string, string>(); Parameters = [];
GeneratedAt = DateTime.UtcNow; GeneratedAt = DateTime.UtcNow;
} }
} }

View file

@ -1,5 +1,4 @@
using System; using System;
using System.Collections.Generic;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
namespace Kurs.Platform.Reports namespace Kurs.Platform.Reports

View file

@ -6,24 +6,13 @@ namespace Kurs.Platform.Reports
public class ReportParameterDto public class ReportParameterDto
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public Guid ReportTemplateId { get; set; } public Guid ReportTemplateId { get; set; }
[Required] [Required]
[StringLength(100)]
public string Name { get; set; } public string Name { get; set; }
[StringLength(200)]
public string Placeholder { get; set; } public string Placeholder { get; set; }
public string Type { get; set; }
public ReportParameterType Type { get; set; }
[StringLength(500)]
public string DefaultValue { get; set; } public string DefaultValue { get; set; }
public bool Required { get; set; } public bool Required { get; set; }
[StringLength(1000)]
public string Description { get; set; } public string Description { get; set; }
} }
} }

View file

@ -1,13 +0,0 @@
using System;
namespace Kurs.Platform.Reports
{
public enum ReportParameterType
{
Text = 0,
Number = 1,
Date = 2,
Email = 3,
Url = 4
}
}

View file

@ -8,20 +8,13 @@ namespace Kurs.Platform.Reports
public class ReportTemplateDto : FullAuditedEntityDto<Guid> public class ReportTemplateDto : FullAuditedEntityDto<Guid>
{ {
[Required] [Required]
[StringLength(256)]
public string Name { get; set; } public string Name { get; set; }
[StringLength(1000)]
public string Description { get; set; } public string Description { get; set; }
[Required] [Required]
public string HtmlContent { get; set; } public string HtmlContent { get; set; }
[StringLength(100)]
public string Category { get; set; } public string Category { get; set; }
public List<string> Tags { get; set; } public List<string> Tags { get; set; }
public List<ReportParameterDto> Parameters { get; set; } public List<ReportParameterDto> Parameters { get; set; }
public ReportTemplateDto() public ReportTemplateDto()

View file

@ -7,26 +7,19 @@ namespace Kurs.Platform.Reports
public class UpdateReportTemplateDto public class UpdateReportTemplateDto
{ {
[Required] [Required]
[StringLength(256)]
public string Name { get; set; } public string Name { get; set; }
[StringLength(1000)]
public string Description { get; set; } public string Description { get; set; }
[Required] [Required]
public string HtmlContent { get; set; } public string HtmlContent { get; set; }
[StringLength(100)]
public string Category { get; set; } public string Category { get; set; }
public List<string> Tags { get; set; } public List<string> Tags { get; set; }
public List<UpdateReportParameterDto> Parameters { get; set; } public List<UpdateReportParameterDto> Parameters { get; set; }
public UpdateReportTemplateDto() public UpdateReportTemplateDto()
{ {
Tags = new List<string>(); Tags = [];
Parameters = new List<UpdateReportParameterDto>(); Parameters = [];
} }
} }
@ -35,20 +28,11 @@ namespace Kurs.Platform.Reports
public Guid? Id { get; set; } public Guid? Id { get; set; }
[Required] [Required]
[StringLength(100)]
public string Name { get; set; } public string Name { get; set; }
[StringLength(200)]
public string Placeholder { get; set; } public string Placeholder { get; set; }
public string Type { get; set; }
public ReportParameterType Type { get; set; }
[StringLength(500)]
public string DefaultValue { get; set; } public string DefaultValue { get; set; }
public bool Required { get; set; } public bool Required { get; set; }
[StringLength(1000)]
public string Description { get; set; } public string Description { get; set; }
} }
} }

View file

@ -100,7 +100,7 @@ public class ReportAppService : PlatformAppService, IReportAppService
template.Id, template.Id,
paramDto.Name, paramDto.Name,
paramDto.Placeholder, paramDto.Placeholder,
(Entities.ReportParameterType)paramDto.Type, paramDto.Type,
paramDto.Required) paramDto.Required)
{ {
DefaultValue = paramDto.DefaultValue, DefaultValue = paramDto.DefaultValue,
@ -140,7 +140,7 @@ public class ReportAppService : PlatformAppService, IReportAppService
template.Id, template.Id,
paramDto.Name, paramDto.Name,
paramDto.Placeholder, paramDto.Placeholder,
(Entities.ReportParameterType)paramDto.Type, paramDto.Type,
paramDto.Required); paramDto.Required);
parameter.DefaultValue = paramDto.DefaultValue; parameter.DefaultValue = paramDto.DefaultValue;
@ -288,7 +288,7 @@ public class ReportAppService : PlatformAppService, IReportAppService
ReportTemplateId = p.ReportTemplateId, ReportTemplateId = p.ReportTemplateId,
Name = p.Name, Name = p.Name,
Placeholder = p.Placeholder, Placeholder = p.Placeholder,
Type = (Reports.ReportParameterType)p.Type, Type = p.Type,
DefaultValue = p.DefaultValue, DefaultValue = p.DefaultValue,
Required = p.Required, Required = p.Required,
Description = p.Description Description = p.Description

View file

@ -22,16 +22,13 @@ namespace Kurs.Platform.Reports
.ForMember(dest => dest.Tags, opt => opt.MapFrom(src => ConvertTagsToJson(src.Tags))) .ForMember(dest => dest.Tags, opt => opt.MapFrom(src => ConvertTagsToJson(src.Tags)))
.ForMember(dest => dest.Parameters, opt => opt.Ignore()); .ForMember(dest => dest.Parameters, opt => opt.Ignore());
CreateMap<ReportParameter, ReportParameterDto>() CreateMap<ReportParameter, ReportParameterDto>();
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => (ReportParameterType)src.Type));
CreateMap<CreateReportParameterDto, ReportParameter>() CreateMap<CreateReportParameterDto, ReportParameter>()
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => (Entities.ReportParameterType)src.Type))
.ForMember(dest => dest.Id, opt => opt.Ignore()) .ForMember(dest => dest.Id, opt => opt.Ignore())
.ForMember(dest => dest.ReportTemplateId, opt => opt.Ignore()); .ForMember(dest => dest.ReportTemplateId, opt => opt.Ignore());
CreateMap<UpdateReportParameterDto, ReportParameter>() CreateMap<UpdateReportParameterDto, ReportParameter>()
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => (Entities.ReportParameterType)src.Type))
.ForMember(dest => dest.ReportTemplateId, opt => opt.Ignore()); .ForMember(dest => dest.ReportTemplateId, opt => opt.Ignore());
CreateMap<ReportGenerated, GeneratedReportDto>() CreateMap<ReportGenerated, GeneratedReportDto>()

View file

@ -4,37 +4,18 @@ using Volo.Abp.Domain.Entities.Auditing;
namespace Kurs.Platform.Entities namespace Kurs.Platform.Entities
{ {
public enum ReportParameterType
{
Text = 0,
Number = 1,
Date = 2,
Email = 3,
Url = 4
}
public class ReportParameter : FullAuditedEntity<Guid> public class ReportParameter : FullAuditedEntity<Guid>
{ {
public Guid ReportTemplateId { get; set; } public Guid ReportTemplateId { get; set; }
[Required] [Required]
[StringLength(100)]
public string Name { get; set; } public string Name { get; set; }
[StringLength(200)]
public string Placeholder { get; set; } public string Placeholder { get; set; }
public string Type { get; set; }
public ReportParameterType Type { get; set; }
[StringLength(500)]
public string DefaultValue { get; set; } public string DefaultValue { get; set; }
public bool Required { get; set; } public bool Required { get; set; }
[StringLength(1000)]
public string Description { get; set; } public string Description { get; set; }
// Navigation property
public virtual ReportTemplate ReportTemplate { get; set; } public virtual ReportTemplate ReportTemplate { get; set; }
public ReportParameter() public ReportParameter()
@ -46,7 +27,7 @@ namespace Kurs.Platform.Entities
Guid reportTemplateId, Guid reportTemplateId,
string name, string name,
string placeholder, string placeholder,
ReportParameterType type, string type,
bool required = false bool required = false
) : base(id) ) : base(id)
{ {

View file

@ -8,26 +8,19 @@ namespace Kurs.Platform.Entities
public class ReportTemplate : FullAuditedAggregateRoot<Guid> public class ReportTemplate : FullAuditedAggregateRoot<Guid>
{ {
[Required] [Required]
[StringLength(256)]
public string Name { get; set; } public string Name { get; set; }
[StringLength(1000)]
public string Description { get; set; } public string Description { get; set; }
[Required] [Required]
public string HtmlContent { get; set; } public string HtmlContent { get; set; }
[StringLength(100)]
public string Category { get; set; } public string Category { get; set; }
public string Tags { get; set; } // JSON string array public string Tags { get; set; } // JSON string array
// Navigation property
public virtual ICollection<ReportParameter> Parameters { get; set; } public virtual ICollection<ReportParameter> Parameters { get; set; }
public ReportTemplate() public ReportTemplate()
{ {
Parameters = new List<ReportParameter>(); Parameters = [];
} }
public ReportTemplate( public ReportTemplate(