Report App Service2
This commit is contained in:
parent
8d3f39a2e9
commit
104d92fbc8
12 changed files with 16 additions and 113 deletions
|
|
@ -7,46 +7,30 @@ namespace Kurs.Platform.Reports
|
|||
public class CreateReportTemplateDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(256)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[StringLength(1000)]
|
||||
public string Description { get; set; }
|
||||
|
||||
[Required]
|
||||
public string HtmlContent { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string Category { get; set; }
|
||||
|
||||
public List<string> Tags { get; set; }
|
||||
|
||||
public List<CreateReportParameterDto> Parameters { get; set; }
|
||||
|
||||
public CreateReportTemplateDto()
|
||||
{
|
||||
Tags = new List<string>();
|
||||
Parameters = new List<CreateReportParameterDto>();
|
||||
Tags = [];
|
||||
Parameters = [];
|
||||
}
|
||||
}
|
||||
|
||||
public class CreateReportParameterDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[StringLength(200)]
|
||||
public string Placeholder { get; set; }
|
||||
|
||||
public ReportParameterType Type { get; set; }
|
||||
|
||||
[StringLength(500)]
|
||||
public string Type { get; set; }
|
||||
public string DefaultValue { get; set; }
|
||||
|
||||
public bool Required { get; set; }
|
||||
|
||||
[StringLength(1000)]
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Kurs.Platform.Reports
|
|||
|
||||
public GenerateReportDto()
|
||||
{
|
||||
Parameters = new Dictionary<string, string>();
|
||||
Parameters = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,21 +10,17 @@ namespace Kurs.Platform.Reports
|
|||
public Guid? TemplateId { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(256)]
|
||||
public string TemplateName { get; set; }
|
||||
|
||||
[Required]
|
||||
public string GeneratedContent { get; set; }
|
||||
|
||||
public Dictionary<string, string> Parameters { get; set; }
|
||||
|
||||
public DateTime GeneratedAt { get; set; }
|
||||
|
||||
public ReportTemplateDto Template { get; set; }
|
||||
|
||||
public GeneratedReportDto()
|
||||
{
|
||||
Parameters = new Dictionary<string, string>();
|
||||
Parameters = [];
|
||||
GeneratedAt = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
|
||||
namespace Kurs.Platform.Reports
|
||||
|
|
|
|||
|
|
@ -6,24 +6,13 @@ namespace Kurs.Platform.Reports
|
|||
public class ReportParameterDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public Guid ReportTemplateId { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[StringLength(200)]
|
||||
public string Placeholder { get; set; }
|
||||
|
||||
public ReportParameterType Type { get; set; }
|
||||
|
||||
[StringLength(500)]
|
||||
public string Type { get; set; }
|
||||
public string DefaultValue { get; set; }
|
||||
|
||||
public bool Required { get; set; }
|
||||
|
||||
[StringLength(1000)]
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Kurs.Platform.Reports
|
||||
{
|
||||
public enum ReportParameterType
|
||||
{
|
||||
Text = 0,
|
||||
Number = 1,
|
||||
Date = 2,
|
||||
Email = 3,
|
||||
Url = 4
|
||||
}
|
||||
}
|
||||
|
|
@ -8,20 +8,13 @@ namespace Kurs.Platform.Reports
|
|||
public class ReportTemplateDto : FullAuditedEntityDto<Guid>
|
||||
{
|
||||
[Required]
|
||||
[StringLength(256)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[StringLength(1000)]
|
||||
public string Description { get; set; }
|
||||
|
||||
[Required]
|
||||
public string HtmlContent { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string Category { get; set; }
|
||||
|
||||
public List<string> Tags { get; set; }
|
||||
|
||||
public List<ReportParameterDto> Parameters { get; set; }
|
||||
|
||||
public ReportTemplateDto()
|
||||
|
|
|
|||
|
|
@ -7,26 +7,19 @@ namespace Kurs.Platform.Reports
|
|||
public class UpdateReportTemplateDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(256)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[StringLength(1000)]
|
||||
public string Description { get; set; }
|
||||
|
||||
[Required]
|
||||
public string HtmlContent { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string Category { get; set; }
|
||||
|
||||
public List<string> Tags { get; set; }
|
||||
|
||||
public List<UpdateReportParameterDto> Parameters { get; set; }
|
||||
|
||||
public UpdateReportTemplateDto()
|
||||
{
|
||||
Tags = new List<string>();
|
||||
Parameters = new List<UpdateReportParameterDto>();
|
||||
Tags = [];
|
||||
Parameters = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -35,20 +28,11 @@ namespace Kurs.Platform.Reports
|
|||
public Guid? Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[StringLength(200)]
|
||||
public string Placeholder { get; set; }
|
||||
|
||||
public ReportParameterType Type { get; set; }
|
||||
|
||||
[StringLength(500)]
|
||||
public string Type { get; set; }
|
||||
public string DefaultValue { get; set; }
|
||||
|
||||
public bool Required { get; set; }
|
||||
|
||||
[StringLength(1000)]
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class ReportAppService : PlatformAppService, IReportAppService
|
|||
template.Id,
|
||||
paramDto.Name,
|
||||
paramDto.Placeholder,
|
||||
(Entities.ReportParameterType)paramDto.Type,
|
||||
paramDto.Type,
|
||||
paramDto.Required)
|
||||
{
|
||||
DefaultValue = paramDto.DefaultValue,
|
||||
|
|
@ -140,7 +140,7 @@ public class ReportAppService : PlatformAppService, IReportAppService
|
|||
template.Id,
|
||||
paramDto.Name,
|
||||
paramDto.Placeholder,
|
||||
(Entities.ReportParameterType)paramDto.Type,
|
||||
paramDto.Type,
|
||||
paramDto.Required);
|
||||
|
||||
parameter.DefaultValue = paramDto.DefaultValue;
|
||||
|
|
@ -288,7 +288,7 @@ public class ReportAppService : PlatformAppService, IReportAppService
|
|||
ReportTemplateId = p.ReportTemplateId,
|
||||
Name = p.Name,
|
||||
Placeholder = p.Placeholder,
|
||||
Type = (Reports.ReportParameterType)p.Type,
|
||||
Type = p.Type,
|
||||
DefaultValue = p.DefaultValue,
|
||||
Required = p.Required,
|
||||
Description = p.Description
|
||||
|
|
|
|||
|
|
@ -22,16 +22,13 @@ namespace Kurs.Platform.Reports
|
|||
.ForMember(dest => dest.Tags, opt => opt.MapFrom(src => ConvertTagsToJson(src.Tags)))
|
||||
.ForMember(dest => dest.Parameters, opt => opt.Ignore());
|
||||
|
||||
CreateMap<ReportParameter, ReportParameterDto>()
|
||||
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => (ReportParameterType)src.Type));
|
||||
CreateMap<ReportParameter, ReportParameterDto>();
|
||||
|
||||
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.ReportTemplateId, opt => opt.Ignore());
|
||||
|
||||
CreateMap<UpdateReportParameterDto, ReportParameter>()
|
||||
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => (Entities.ReportParameterType)src.Type))
|
||||
.ForMember(dest => dest.ReportTemplateId, opt => opt.Ignore());
|
||||
|
||||
CreateMap<ReportGenerated, GeneratedReportDto>()
|
||||
|
|
|
|||
|
|
@ -4,37 +4,18 @@ using Volo.Abp.Domain.Entities.Auditing;
|
|||
|
||||
namespace Kurs.Platform.Entities
|
||||
{
|
||||
public enum ReportParameterType
|
||||
{
|
||||
Text = 0,
|
||||
Number = 1,
|
||||
Date = 2,
|
||||
Email = 3,
|
||||
Url = 4
|
||||
}
|
||||
|
||||
public class ReportParameter : FullAuditedEntity<Guid>
|
||||
{
|
||||
public Guid ReportTemplateId { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[StringLength(200)]
|
||||
public string Placeholder { get; set; }
|
||||
|
||||
public ReportParameterType Type { get; set; }
|
||||
|
||||
[StringLength(500)]
|
||||
public string Type { get; set; }
|
||||
public string DefaultValue { get; set; }
|
||||
|
||||
public bool Required { get; set; }
|
||||
|
||||
[StringLength(1000)]
|
||||
public string Description { get; set; }
|
||||
|
||||
// Navigation property
|
||||
public virtual ReportTemplate ReportTemplate { get; set; }
|
||||
|
||||
public ReportParameter()
|
||||
|
|
@ -46,7 +27,7 @@ namespace Kurs.Platform.Entities
|
|||
Guid reportTemplateId,
|
||||
string name,
|
||||
string placeholder,
|
||||
ReportParameterType type,
|
||||
string type,
|
||||
bool required = false
|
||||
) : base(id)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,26 +8,19 @@ namespace Kurs.Platform.Entities
|
|||
public class ReportTemplate : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
[Required]
|
||||
[StringLength(256)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[StringLength(1000)]
|
||||
public string Description { get; set; }
|
||||
|
||||
[Required]
|
||||
public string HtmlContent { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string Category { get; set; }
|
||||
|
||||
public string Tags { get; set; } // JSON string array
|
||||
|
||||
// Navigation property
|
||||
public virtual ICollection<ReportParameter> Parameters { get; set; }
|
||||
|
||||
public ReportTemplate()
|
||||
{
|
||||
Parameters = new List<ReportParameter>();
|
||||
Parameters = [];
|
||||
}
|
||||
|
||||
public ReportTemplate(
|
||||
|
|
|
|||
Loading…
Reference in a new issue