sozsoft-platform/api/src/Sozsoft.Platform.Application/DeveloperKit/CustomComponentAppService.cs

45 lines
1.2 KiB
C#
Raw Normal View History

2026-02-24 20:44:16 +00:00
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
2026-03-02 07:36:38 +00:00
using Microsoft.AspNetCore.Authorization;
2026-02-24 20:44:16 +00:00
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;
2026-03-02 07:36:38 +00:00
[Authorize]
2026-02-24 20:44:16 +00:00
public class CustomComponentAppService : CrudAppService<
CustomComponent,
CustomComponentDto,
Guid,
PagedAndSortedResultRequestDto,
CreateUpdateCustomComponentDto>, ICustomComponentAppService
{
public CustomComponentAppService(IRepository<CustomComponent, Guid> repository) : base(repository)
{
}
2026-08-05 20:51:43 +00:00
public override async Task<CustomComponentDto> 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);
}
2026-02-24 20:44:16 +00:00
public async Task<List<CustomComponentDto>> GetActiveComponentsAsync()
{
var components = await Repository.GetListAsync(x => x.IsActive);
return await MapToGetListOutputDtosAsync(components);
}
}