using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Sozsoft.Platform.DeveloperKit; using Sozsoft.Platform.Entities; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; namespace Platform.Api.Application; [Authorize] public class CustomComponentAppService : CrudAppService< CustomComponent, CustomComponentDto, Guid, PagedAndSortedResultRequestDto, CreateUpdateCustomComponentDto>, ICustomComponentAppService { public CustomComponentAppService(IRepository repository) : base(repository) { } public override async Task UpdateAsync( Guid id, CreateUpdateCustomComponentDto input) { if (input.Props is null) { var existingComponent = await Repository.GetAsync(id); input.Props = existingComponent.Props; } return await base.UpdateAsync(id, input); } public async Task> GetActiveComponentsAsync() { var components = await Repository.GetListAsync(x => x.IsActive); return await MapToGetListOutputDtosAsync(components); } }