Skip to content

Commit

Permalink
Removed abstractions that represent application logic (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDave1999 committed Feb 8, 2023
1 parent 58d992c commit 3976bb8
Show file tree
Hide file tree
Showing 73 changed files with 98 additions and 265 deletions.
50 changes: 25 additions & 25 deletions src/Extensions/ApplicationDependencies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ public static class ApplicationDependencies
{
public static IServiceCollection AddServices(this IServiceCollection services)
{
services.AddScoped<IAuthService, AuthService>()
.AddScoped<IUserService, UserService>()
.AddScoped<IUserRegisterService, UserRegisterService>()
.AddScoped<IEmailVerificationService, EmailVerificationService>()
.AddScoped<IEmailTemplateService, EmailTemplateService>()
.AddScoped<IEmailService, EmailService>()
.AddScoped<ISpecificTreatmentService, SpecificTreatmentService>()
.AddScoped<IGeneralTreatmentService, GeneralTreatmentService>()
.AddScoped<IProformaInvoiceService, ProformaInvoiceService>()
.AddScoped<IPasswordResetService, PasswordResetService>()
.AddScoped<IDependentService, DependentService>()
.AddScoped<ITokenRefreshService, TokenRefreshService>()
.AddScoped<IEmployeeService, EmployeeService>()
.AddScoped<IRoleService, RoleService>()
.AddScoped<IOfficeService, OfficeService>()
.AddScoped<IAppointmentService, AppointmentService>()
.AddScoped<IAppointmentCancellationService, AppointmentCancellationService>()
.AddScoped<IEmployeeScheduleService, EmployeeScheduleService>()
.AddScoped<IFavoriteDentistService, FavoriteDentistService>()
.AddScoped<IOfficeScheduleService, OfficeScheduleService>()
.AddScoped<IAvailabilityService, AvailabilityService>()
.AddScoped<IPersonService, PersonService>()
.AddScoped<IReportDownloadPdfService, ReportDownloadPdfService>()
.AddScoped<IPublicHolidayService, PublicHolidayService>()
.AddScoped<ITokenService, TokenService>();
services.AddScoped<AuthService>()
.AddScoped<UserService>()
.AddScoped<UserRegisterService>()
.AddScoped<EmailVerificationService>()
.AddScoped<SpecificTreatmentService>()
.AddScoped<GeneralTreatmentService>()
.AddScoped<ProformaInvoiceService>()
.AddScoped<PasswordResetService>()
.AddScoped<DependentService>()
.AddScoped<TokenRefreshService>()
.AddScoped<EmployeeService>()
.AddScoped<RoleService>()
.AddScoped<OfficeService>()
.AddScoped<AppointmentService>()
.AddScoped<AppointmentCancellationService>()
.AddScoped<EmployeeScheduleService>()
.AddScoped<FavoriteDentistService>()
.AddScoped<OfficeScheduleService>()
.AddScoped<AvailabilityService>()
.AddScoped<PersonService>()
.AddScoped<ReportDownloadPdfService>()
.AddScoped<PublicHolidayService>()
.AddScoped<EmailTemplateService>()
.AddScoped<ITokenService, TokenService>()
.AddScoped<IEmailService, EmailService>();

return services;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[ApiController]
public class AppointmentCancellationController : ControllerBase
{
private readonly IAppointmentCancellationService _appointmentService;
private readonly AppointmentCancellationService _appointmentService;

public AppointmentCancellationController(IAppointmentCancellationService appointmentService)
public AppointmentCancellationController(AppointmentCancellationService appointmentService)
{
_appointmentService = appointmentService;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DentallApp.Features.AppointmentCancellation;

public partial class AppointmentCancellationService : IAppointmentCancellationService
public partial class AppointmentCancellationService
{
private readonly IAppointmentCancellationRepository _appointmentRepository;
private readonly IInstantMessaging _instantMessaging;
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions src/Features/Appointments/AppointmentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
[ApiController]
public class AppointmentController : ControllerBase
{
private readonly IAppointmentService _appointmentService;
private readonly AppointmentService _appointmentService;
private readonly IAppointmentRepository _appointmentRepository;

public AppointmentController(IAppointmentService appointmentService, IAppointmentRepository appointmentRepository)
public AppointmentController(AppointmentService appointmentService, IAppointmentRepository appointmentRepository)
{
_appointmentService = appointmentService;
_appointmentRepository = appointmentRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Features/Appointments/AppointmentService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DentallApp.Features.Appointments;

public class AppointmentService : IAppointmentService
public class AppointmentService
{
private readonly IAppointmentRepository _appointmentRepository;
private readonly IDateTimeProvider _dateTimeProvider;
Expand Down
8 changes: 0 additions & 8 deletions src/Features/Appointments/IAppointmentService.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Features/Authentication/AuthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
[ApiController]
public class AuthController : ControllerBase
{
private readonly IAuthService _authService;
private readonly AuthService _authService;

public AuthController(IAuthService authService)
public AuthController(AuthService authService)
{
_authService = authService;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Features/Authentication/AuthService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DentallApp.Features.Authentication;

public class AuthService : IAuthService
public class AuthService
{
private readonly IUserRepository _userRepository;
private readonly IEmployeeRepository _employeeRepository;
Expand Down
6 changes: 0 additions & 6 deletions src/Features/Authentication/IAuthService.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Features/AvailabilityHours/AvailabilityController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[ApiController]
public class AvailabilityController : ControllerBase
{
private readonly IAvailabilityService _availabilityService;
private readonly AvailabilityService _availabilityService;

public AvailabilityController(IAvailabilityService availabilityService)
public AvailabilityController(AvailabilityService availabilityService)
{
_availabilityService = availabilityService;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Features/AvailabilityHours/AvailabilityService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DentallApp.Features.AvailabilityHours;

public class AvailabilityService : IAvailabilityService
public class AvailabilityService
{
private readonly IAppointmentRepository _appointmentRepository;
private readonly IEmployeeScheduleRepository _employeeScheduleRepository;
Expand Down
6 changes: 0 additions & 6 deletions src/Features/AvailabilityHours/IAvailabilityService.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Features/Chatbot/AppointmentBotService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ public async Task<List<AdaptiveChoice>> GetPatientsAsync(UserProfile userProfile
public async Task<Response<IEnumerable<AvailableTimeRangeDto>>> GetAvailableHoursAsync(AvailableTimeRangePostDto availableTimeRangeDto)
{
using var scope = _serviceProvider.CreateScope();
var availabilityService = scope.ServiceProvider.GetRequiredService<IAvailabilityService>();
var availabilityService = scope.ServiceProvider.GetRequiredService<AvailabilityService>();
return await availabilityService.GetAvailableHoursAsync(availableTimeRangeDto);
}

public async Task<Response<DtoBase>> CreateScheduledAppointmentAsync(AppointmentInsertDto appointment)
{
using var scope = _serviceProvider.CreateScope();
var appointmentService = scope.ServiceProvider.GetRequiredService<IAppointmentService>();
var appointmentService = scope.ServiceProvider.GetRequiredService<AppointmentService>();
return await appointmentService.CreateAppointmentAsync(appointment);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Features/Dependents/DependentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
[ApiController]
public class DependentController : ControllerBase
{
private readonly IDependentService _dependentService;
private readonly DependentService _dependentService;
private readonly IDependentRepository _dependentRepository;

public DependentController(IDependentService dependentService, IDependentRepository dependentRepository)
public DependentController(DependentService dependentService, IDependentRepository dependentRepository)
{
_dependentService = dependentService;
_dependentRepository = dependentRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Features/Dependents/DependentService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DentallApp.Features.Dependents;

public class DependentService : IDependentService
public class DependentService
{
private readonly IUnitOfWork _unitOfWork;

Expand Down
8 changes: 0 additions & 8 deletions src/Features/Dependents/IDependentService.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Features/EmailSending/EmailService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
public class EmailService : IEmailService
{
private readonly ISendGridClient _client;
private readonly IEmailTemplateService _emailTemplate;
private readonly EmailTemplateService _emailTemplate;
private readonly AppSettings _settings;

public EmailService(ISendGridClient client, IEmailTemplateService emailTemplate, AppSettings settings)
public EmailService(ISendGridClient client, EmailTemplateService emailTemplate, AppSettings settings)
{
_client = client;
_settings = settings;
Expand Down
2 changes: 1 addition & 1 deletion src/Features/EmailSending/EmailTemplateService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DentallApp.Features.EmailSending;

public class EmailTemplateService : IEmailTemplateService
public class EmailTemplateService
{
public async Task<string> LoadTemplateForEmailVerificationAsync(string url, string recipientName)
{
Expand Down
7 changes: 0 additions & 7 deletions src/Features/EmailSending/IEmailTemplateService.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Features/EmailVerification/EmailVerificationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
[ApiController]
public class EmailVerificationController : ControllerBase
{
private readonly IEmailVerificationService _service;
private readonly EmailVerificationService _service;

public EmailVerificationController(IEmailVerificationService service)
public EmailVerificationController(EmailVerificationService service)
{
_service = service;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Features/EmailVerification/EmailVerificationService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DentallApp.Features.EmailVerification;

public class EmailVerificationService : IEmailVerificationService
public class EmailVerificationService
{
private readonly IUserRepository _userRepository;
private readonly ITokenService _tokenService;
Expand Down
6 changes: 0 additions & 6 deletions src/Features/EmailVerification/IEmailVerificationService.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Features/EmployeeSchedules/EmployeeScheduleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
[ApiController]
public class EmployeeScheduleController : ControllerBase
{
private readonly IEmployeeScheduleService _employeeScheduleService;
private readonly EmployeeScheduleService _employeeScheduleService;
private readonly IEmployeeScheduleRepository _employeeScheduleRepository;

public EmployeeScheduleController(IEmployeeScheduleService employeeScheduleService,
public EmployeeScheduleController(EmployeeScheduleService employeeScheduleService,
IEmployeeScheduleRepository employeeScheduleRepository)
{
_employeeScheduleService = employeeScheduleService;
Expand Down
2 changes: 1 addition & 1 deletion src/Features/EmployeeSchedules/EmployeeScheduleService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DentallApp.Features.EmployeeSchedules;

public class EmployeeScheduleService : IEmployeeScheduleService
public class EmployeeScheduleService
{
private readonly IEmployeeScheduleRepository _employeeScheduleRepository;

Expand Down
7 changes: 0 additions & 7 deletions src/Features/EmployeeSchedules/IEmployeeScheduleService.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Features/Employees/EmployeeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
[ApiController]
public class EmployeeController : ControllerBase
{
private readonly IEmployeeService _employeeService;
private readonly EmployeeService _employeeService;
private readonly IEmployeeRepository _employeeRepository;

public EmployeeController(IEmployeeService employeeService, IEmployeeRepository employeeRepository)
public EmployeeController(EmployeeService employeeService, IEmployeeRepository employeeRepository)
{
_employeeService = employeeService;
_employeeRepository = employeeRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Features/Employees/EmployeeService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DentallApp.Features.Employees;

public class EmployeeService : IEmployeeService
public class EmployeeService
{
private readonly IUnitOfWork _unitOfWork;
private readonly IPasswordHasher _passwordHasher;
Expand Down
9 changes: 0 additions & 9 deletions src/Features/Employees/IEmployeeService.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Features/FavoriteDentists/FavoriteDentistController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
[ApiController]
public class FavoriteDentistController : ControllerBase
{
private readonly IFavoriteDentistService _favoriteDentistService;
private readonly FavoriteDentistService _favoriteDentistService;
private readonly IFavoriteDentistRepository _favoriteDentistRepository;

public FavoriteDentistController(IFavoriteDentistService favoriteDentistService,
public FavoriteDentistController(FavoriteDentistService favoriteDentistService,
IFavoriteDentistRepository favoriteDentistRepository)
{
_favoriteDentistService = favoriteDentistService;
Expand Down
2 changes: 1 addition & 1 deletion src/Features/FavoriteDentists/FavoriteDentistService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DentallApp.Features.FavoriteDentists;

public class FavoriteDentistService : IFavoriteDentistService
public class FavoriteDentistService
{
private readonly IFavoriteDentistRepository _favoriteDentistRepository;

Expand Down
8 changes: 0 additions & 8 deletions src/Features/FavoriteDentists/IFavoriteDentistService.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Features/GeneralTreatments/GeneralTreatmentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
[ApiController]
public class GeneralTreatmentController : ControllerBase
{
private readonly IGeneralTreatmentService _treatmentService;
private readonly GeneralTreatmentService _treatmentService;
private readonly IGeneralTreatmentRepository _treatmentRepository;

public GeneralTreatmentController(IGeneralTreatmentService treatmentService,
public GeneralTreatmentController(GeneralTreatmentService treatmentService,
IGeneralTreatmentRepository treatmentRepository)
{
_treatmentService = treatmentService;
Expand Down
2 changes: 1 addition & 1 deletion src/Features/GeneralTreatments/GeneralTreatmentService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DentallApp.Features.GeneralTreatments;

public class GeneralTreatmentService : IGeneralTreatmentService
public class GeneralTreatmentService
{
private readonly IGeneralTreatmentRepository _treatmentRepository;
private readonly string _basePath;
Expand Down
9 changes: 0 additions & 9 deletions src/Features/GeneralTreatments/IGeneralTreatmentService.cs

This file was deleted.

Loading

0 comments on commit 3976bb8

Please sign in to comment.