refactor: remove legacy services and controllers

This commit is contained in:
2025-07-30 15:39:30 +02:00
parent 5466b35b95
commit 13acf6de08
27 changed files with 8 additions and 604 deletions

View File

@@ -1,10 +0,0 @@
using DigitalData.Core.Abstraction.Application;
using WorkFlow.Application.Dto.Config;
using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts;
[Obsolete("Use MediatR")]
public interface IConfigService : ICRUDService<ConfigCreateDto, ConfigDto, Config, int>
{
}

View File

@@ -1,10 +0,0 @@
using DigitalData.Core.Abstraction.Application;
using WorkFlow.Application.Dto.ProfileControlsTF;
using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts;
[Obsolete("Use MediatR")]
public interface IProfileControlsTFService : ICRUDService<ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTF, long>
{
}

View File

@@ -1,15 +0,0 @@
using DigitalData.Core.Abstraction.Application;
using DigitalData.Core.Abstraction.Application.DTO;
using WorkFlow.Application.Dto.ProfileObjState;
using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts;
[Obsolete("Use MediatR")]
public interface IProfileObjStateService : ICRUDService<ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjState, long>
{
Task<DataResult<IEnumerable<ProfileObjStateDto>>> ReadAsync(
bool withProfile = true, bool withUser = true, bool withState = true,
int? userId = null, string? username = null,
int? profileId = null, int? objId = null);
}

View File

@@ -1,10 +0,0 @@
using DigitalData.Core.Abstraction.Application;
using WorkFlow.Application.Dto.State;
using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts;
[Obsolete("Use MediatR")]
public interface IStateService : ICRUDService<StateCreateDto, StateDto, State, int>
{
}

View File

@@ -1,10 +0,0 @@
using DigitalData.Core.Abstraction.Application.Repository;
using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts.Repositories;
[Obsolete("Use IRepository")]
public interface IButtonRepository : ICRUDRepository<Button, int>
{
public Task<IEnumerable<Button>> ReadAllAsync(int profileId);
}

View File

@@ -1,9 +0,0 @@
using DigitalData.Core.Abstraction.Application.Repository;
using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts.Repositories;
[Obsolete("Use IRepository")]
public interface IConfigRepository : ICRUDRepository<Config, int>
{
}

View File

@@ -1,9 +0,0 @@
using DigitalData.Core.Abstraction.Application.Repository;
using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts.Repositories;
[Obsolete("Use IRepository")]
public interface IProfileControlsTFRepository : ICRUDRepository<ProfileControlsTF, long>
{
}

View File

@@ -1,14 +0,0 @@
using DigitalData.Core.Abstraction.Application.Repository;
using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts.Repositories;
[Obsolete("Use IRepository")]
public interface IProfileObjStateRepository : ICRUDRepository<ProfileObjState, long>
{
Task<IEnumerable<ProfileObjState>> ReadAsync(
bool isReadonly = true,
bool withProfile = true, bool withUser = true, bool withState = true,
int? userId = null, string? username = null,
int? profileId = null, int? objId = null);
}

View File

@@ -1,9 +0,0 @@
using DigitalData.Core.Abstraction.Application.Repository;
using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts.Repositories;
[Obsolete("Use IRepository")]
public interface IStateRepository : ICRUDRepository<State, int>
{
}

View File

@@ -1,7 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using WorkFlow.Application.Contracts;
using WorkFlow.Application.Services;
namespace WorkFlow.Application;
@@ -14,10 +11,6 @@ public static class DependencyInjection
options?.Invoke(diOptions);
services.AddAutoMapper(typeof(MappingProfile).Assembly);
services.TryAddScoped<IConfigService, ConfigService>();
services.TryAddScoped<IProfileControlsTFService, ProfileControlsTFService>();
services.TryAddScoped<IProfileObjStateService, ProfileObjStateService>();
services.TryAddScoped<IStateService, StateService>();
services.AddMediatR(cfg =>
{
cfg.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly);

View File

@@ -1,8 +1,10 @@
using AutoMapper;
using DigitalData.Core.Abstraction.Application.Repository;
using MediatR;
using WorkFlow.Application.Buttons;
using WorkFlow.Application.Contracts.Repositories;
using WorkFlow.Application.Dto;
using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Profiles;
@@ -22,7 +24,7 @@ public class ReadProfileHandler : IRequestHandler<ReadProfileQuery, ProfileDto?>
private readonly IProfileObjRepository _objRepository;
private readonly IButtonRepository _bttnRepository;
private readonly IRepository<Button> _bttnRepository;
private readonly IMapper _mapper;
@@ -31,7 +33,7 @@ public class ReadProfileHandler : IRequestHandler<ReadProfileQuery, ProfileDto?>
/// </summary>
/// <param name="profileRepository">The profile repository used to access profile data.</param>
/// <param name="objRepository">The profile object repository used to access object data.</param>
public ReadProfileHandler(IProfileRepository profileRepository, IProfileObjRepository objRepository, IButtonRepository buttonRepository, IMapper mapper)
public ReadProfileHandler(IProfileRepository profileRepository, IProfileObjRepository objRepository, IRepository<Button> buttonRepository, IMapper mapper)
{
_profileRepository = profileRepository;
_objRepository = objRepository;
@@ -56,7 +58,7 @@ public class ReadProfileHandler : IRequestHandler<ReadProfileQuery, ProfileDto?>
if (profile?.Id is int pId)
{
var bttns = await _bttnRepository.ReadAllAsync(pId);
var bttns = await _bttnRepository.Read(b => b.ProfileId == pId).ToListAsync(cancel);
profileDto.Buttons = _mapper.Map<IEnumerable<ButtonDto>>(bttns);
}

View File

@@ -1,18 +0,0 @@
using AutoMapper;
using DigitalData.Core.Application;
using WorkFlow.Application.Contracts;
using WorkFlow.Application.Dto.Config;
using WorkFlow.Domain.Entities;
using WorkFlow.Application.Contracts.Repositories;
using DigitalData.Core.Abstraction.Application;
namespace WorkFlow.Application.Services;
[Obsolete("Use MediatR")]
public class ConfigService : CRUDService<IConfigRepository, ConfigCreateDto, ConfigDto, Config, int>,
IConfigService, ICRUDService<ConfigCreateDto, ConfigDto, Config, int>
{
public ConfigService(IConfigRepository repository, IMapper mapper) : base(repository, mapper)
{
}
}

View File

@@ -1,24 +0,0 @@
using AutoMapper;
using DigitalData.Core.Application;
using WorkFlow.Application.Contracts;
using WorkFlow.Application.Dto.ProfileControlsTF;
using WorkFlow.Domain.Entities;
using WorkFlow.Application.Contracts.Repositories;
using DigitalData.Core.Abstraction.Application;
using DigitalData.Core.Abstraction.Application.DTO;
namespace WorkFlow.Application.Services;
[Obsolete("Use MediatR")]
public class ProfileControlsTFService : CRUDService<IProfileControlsTFRepository, ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTF, long>,
IProfileControlsTFService, ICRUDService<ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTF, long>
{
public ProfileControlsTFService(IProfileControlsTFRepository repository, IMapper mapper) : base(repository, mapper)
{
}
public Task<DataResult<IEnumerable<ProfileControlsTFDto>>> ReadAsync(bool withProfile = true, bool withUser = false, int? userId = null, string? username = null, int? profileId = null, int? objId = null, bool? profileActive = null)
{
throw new NotImplementedException();
}
}

View File

@@ -1,35 +0,0 @@
using AutoMapper;
using DigitalData.Core.Application;
using WorkFlow.Application.Contracts;
using WorkFlow.Application.Dto.ProfileObjState;
using WorkFlow.Domain.Entities;
using WorkFlow.Application.Contracts.Repositories;
using DigitalData.Core.Abstraction.Application;
using DigitalData.Core.Abstraction.Application.DTO;
namespace WorkFlow.Application.Services;
[Obsolete("Use MediatR")]
public class ProfileObjStateService : CRUDService<IProfileObjStateRepository, ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjState, long>,
IProfileObjStateService, ICRUDService<ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjState, long>
{
public ProfileObjStateService(IProfileObjStateRepository repository, IMapper mapper) : base(repository, mapper)
{
}
public async Task<DataResult<IEnumerable<ProfileObjStateDto>>> ReadAsync(
bool withProfile = true, bool withUser = true, bool withState = true,
int? userId = null, string? username = null,
int? profileId = null, int? objId = null)
{
var pos_list = await _repository.ReadAsync(
isReadonly: true,
withProfile: withProfile, withUser: withUser, withState: withState,
userId: userId, username: username,
profileId: profileId, objId: objId);
var post_dto_list = _mapper.Map<IEnumerable<ProfileObjStateDto>>(pos_list);
return Result.Success(post_dto_list);
}
}

View File

@@ -1,18 +0,0 @@
using AutoMapper;
using DigitalData.Core.Application;
using WorkFlow.Application.Contracts;
using WorkFlow.Application.Dto.State;
using WorkFlow.Domain.Entities;
using WorkFlow.Application.Contracts.Repositories;
using DigitalData.Core.Abstraction.Application;
namespace WorkFlow.Application.Services;
[Obsolete("Use MediatR")]
public class StateService : CRUDService<IStateRepository, StateCreateDto, StateDto, State, int>,
IStateService, ICRUDService<StateCreateDto, StateDto, State, int>
{
public StateService(IStateRepository repository, IMapper mapper) : base(repository, mapper)
{
}
}