Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature add service #29

Open
wants to merge 19 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
2dd2095
refactor: add IFormFile Image and delete status property
Wil-JsDev Mar 8, 2025
ea3268f
feat: add confirm appointment dtos
Wil-JsDev Mar 8, 2025
fc53710
refactor(appointments): remove unnecessary properties from DTOs
Wil-JsDev Mar 8, 2025
0fc5681
refactor: delete rating property
Wil-JsDev Mar 8, 2025
4665f2d
refactor(schedule): update holiday names and enforce non-null WeekDay…
Wil-JsDev Mar 8, 2025
3285098
refactor(services): remove PenaltyAmount and unnecessary properties f…
Wil-JsDev Mar 8, 2025
25429f4
feat: add validate method
Wil-JsDev Mar 8, 2025
da5c9a2
feat(appointments): add validation method for appointment dates
Wil-JsDev Mar 8, 2025
568dd2d
feat(services): add method to get services by company ID
Wil-JsDev Mar 8, 2025
fc4a7f5
refactor: delete not appointment status
Wil-JsDev Mar 8, 2025
a129b8d
refactor(appointments): update confirmation and cancellation method s…
Wil-JsDev Mar 8, 2025
17fb639
chore: rename is holiday parameter
Wil-JsDev Mar 8, 2025
46d2942
refactor(services): update discount and price filtering methods
Wil-JsDev Mar 8, 2025
1517382
feat: Register application layer services in DI container
Wil-JsDev Mar 8, 2025
387e23d
feat: add serilog library
Wil-JsDev Mar 8, 2025
c03751c
feat: Register persistence layer services in DI container
Wil-JsDev Mar 8, 2025
5961ce2
refactor: rename entityCreateDto for create method in generic service
Wil-JsDev Mar 8, 2025
40b1368
feat: implements service
Wil-JsDev Mar 8, 2025
0f562be
feat: add generate confirmation service
Wil-JsDev Mar 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Trimly.Core.Application/AddApplication.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
using Microsoft.Extensions.DependencyInjection;
using Trimly.Core.Application.Interfaces.Service;
using Trimly.Core.Application.Services;

namespace Trimly.Core.Application
{
public static class AddApplication
{
public static IServiceCollection AddApplicationLayer(this IServiceCollection services)
{
services.AddScoped<IRegisteredCompaniesService, RegisteredCompaniesService>();
services.AddScoped<IAppointmentService, AppointmentService>();
services.AddScoped<IServicesService, ServicesService>();
services.AddScoped<IReviewService, ReviewService>();
services.AddScoped<ISchedulesService, SchedulesService>();
return services;
}
}
Expand Down
2 changes: 0 additions & 2 deletions Trimly.Core.Application/DTOs/Appointment/AppointmentDTos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ public sealed record AppointmentDTos
DateTime? StartDateTime,
DateTime? EndDateTime,
AppointmentStatus AppointmentStatus,
string? ConfirmationCode,
string? CancellationReason,
Guid? ServiceId,
DateTime? CreatedAt,
DateTime? UpdateAt
Expand Down
10 changes: 10 additions & 0 deletions Trimly.Core.Application/DTOs/Appointment/ConfirmAppointmentDTos.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Trimly.Core.Domain.Enum;

namespace Trimly.Core.Application.DTOs.Appointment;

public sealed record ConfirmAppointmentDTos
(
AppointmentStatus AppointmentStatus,
DateTime? StartDateTime,
DateTime? EndDateTime
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ namespace Trimly.Core.Application.DTOs.Appointment
{
public sealed record CreateAppointmentDTos
(
DateTime? StarDateTime,
DateTime? EndDateTime,
AppointmentStatus AppointmentStatus,
string? CancellationReason,
DateTime StarDateTime,
DateTime EndDateTime,
Guid? ServiceId
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ public sealed record UpdateAppoinmentDTos
(
DateTime? StarDateTime,
DateTime? EndDateTime,
string? CancellationReason,
Guid? ServiceId
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

using Microsoft.AspNetCore.Http;

namespace Trimly.Core.Application.DTOs.RegisteredCompanies
{
public sealed record CreateRegisteredCompaniesDTos
Expand All @@ -9,7 +10,6 @@ public sealed record CreateRegisteredCompaniesDTos
string? AddresCompanies,
string? Email,
string? DescriptionCompanies,
string? LogoUrl,
Domain.Enum.Status? Status
IFormFile? ImageFile
);
}
3 changes: 2 additions & 1 deletion Trimly.Core.Application/DTOs/Review/CreateReviewsDTos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public sealed record CreateReviewsDTos
(
string? Title,
string? Comment,
int Rating
int Rating,
Guid? RegisteredCompanyId
);
}
4 changes: 2 additions & 2 deletions Trimly.Core.Application/DTOs/Schedules/CreateSchedulesDTos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ namespace Trimly.Core.Application.DTOs.Schedules
{
public sealed record CreateSchedulesDTos
(
Weekday? Days,
Weekday Days,
TimeOnly OpeningTime,
TimeOnly ClosingTime,
string? Notes,
Status? IsHolady,
Status? IsHoliday,
Guid? RegisteredCompanyId
);
}
4 changes: 2 additions & 2 deletions Trimly.Core.Application/DTOs/Schedules/SchedulesDTos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ namespace Trimly.Core.Application.DTOs.Schedules
{
public sealed record SchedulesDTos
(
Guid? ShedulesId,
Guid? SchedulesId,
Weekday? Days,
TimeOnly OpeningTime,
TimeOnly ClosingTime,
string? Notes,
Status? IsHolady,
Status? IsHoliday,
Guid? RegisteredCompanyId,
DateTime? CreatedAt,
DateTime? UpdateAt
Expand Down
4 changes: 2 additions & 2 deletions Trimly.Core.Application/DTOs/Schedules/UpdateSchedulesDTos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ namespace Trimly.Core.Application.DTOs.Schedules
{
public sealed record UpdateSchedulesDTos
(
Weekday? Days,
Weekday Days,
TimeOnly OpeningTime,
TimeOnly ClosingTime,
string? Notes,
Status? IsHolady
Status? IsHoliday
);
}
7 changes: 4 additions & 3 deletions Trimly.Core.Application/DTOs/Service/CreateServiceDTos.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

using Microsoft.AspNetCore.Http;

namespace Trimly.Core.Application.DTOs.Service
{
public sealed record CreateServiceDTos
Expand All @@ -7,8 +9,7 @@ public sealed record CreateServiceDTos
decimal Price,
string? Description,
int DurationInMinutes,
string? ImageUrl,
Guid? RegisteredCompanyId,
decimal PenaltyAmount
IFormFile? ImageFile,
Guid? RegisteredCompanyId
);
}
5 changes: 1 addition & 4 deletions Trimly.Core.Application/DTOs/Service/ServiceFilterDTos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ public sealed record ServiceFilterDTos
decimal Price,
string? Description,
int DurationInMinutes,
string? ImageUrl,
Guid? RegisteredCompanyId,
DateTime? CreatedAt,
DateTime? UpdateAt
string? ImageUrl
);
}
3 changes: 1 addition & 2 deletions Trimly.Core.Application/DTOs/Service/ServicesDTos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public sealed record ServicesDTos
Domain.Enum.Status? Status,
Guid? RegisteredCompanyId,
DateTime? CreatedAt,
DateTime? UpdateAt,
decimal PenaltyAmount
DateTime? UpdateAt
);
}
3 changes: 1 addition & 2 deletions Trimly.Core.Application/DTOs/Service/UpdateServiceDTos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public sealed record UpdateServiceDTos
string? Name,
decimal Price,
string? Description,
int DurationInMinutes,
decimal PenaltyAmount
int DurationInMinutes
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public interface IAppointmentRepository : IGenericRepository<Appointments>
Task ConfirmAppointmentAutomaticallyAsync(Appointments appointments,CancellationToken cancellationToken);

Task<int> GetTotalAppointmentCountAsync(Guid serviceId, CancellationToken cancellationToken);

Task<IEnumerable<Appointments>> FilterByStatusAsync(AppointmentStatus appointmentStatus, CancellationToken cancellationToken);

Task<bool> ValidateAppointmentAsync(DateTime startDate, DateTime endDate, CancellationToken cancellationToken);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading;
using System.Linq.Expressions;
using System.Threading;
using Trimly.Core.Application.Pagination;

namespace Trimly.Core.Application.Interfaces.Repository
Expand All @@ -17,5 +18,7 @@ public interface IGenericRepository<TEntity>
Task<PagedResult<TEntity>> GetPagedResultAsync(int pageNumber,int pageSize, CancellationToken cancellationToken);

Task SaveChangesAsync(CancellationToken cancellationToken);

Task<bool> ValidateAsync(Expression<Func<TEntity, bool>> predicate);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

namespace Trimly.Core.Application.Interfaces.Repository
{
public interface IServiceRepository : IGenericRepository<Services>
public interface IServiceRepository : IGenericRepository<Domain.Models.Services>
{
Task<IEnumerable<Services>> GetServicesByNameAsync(Guid registeredCompaniesId, string name,CancellationToken cancellationToken);
Task<IEnumerable<Domain.Models.Services>> GetServicesByNameAsync(Guid registeredCompaniesId, string name,CancellationToken cancellationToken);

Task<IEnumerable<Services>> GetServicesByPriceAsync(Guid registeredCompaniesId, decimal price, CancellationToken cancellationToken);
Task<IEnumerable<Domain.Models.Services>> GetServicesByPriceAsync(Guid registeredCompaniesId, decimal price, CancellationToken cancellationToken);

Task<IEnumerable<Services>> GetServicesByDurationInMinutesAsync(Guid registeredCompaniesId, int durationInMinutes, CancellationToken cancellationToken);
Task<IEnumerable<Domain.Models.Services>> GetServicesByDurationInMinutesAsync(Guid registeredCompaniesId, int durationInMinutes, CancellationToken cancellationToken);

Task ApplyDiscountCodeAsync(Services services, Guid registeredCompaniesId, string discountCode ,CancellationToken cancellationToken);
Task ApplyDiscountCodeAsync(Domain.Models.Services services, Guid registeredCompaniesId, string discountCode ,CancellationToken cancellationToken);

Task<IEnumerable<Services>> GetServicesWithDurationLessThan30MinutesAsync(Guid registeredCompaniesId, CancellationToken cancellationToken);
Task<IEnumerable<Domain.Models.Services>> GetServicesWithDurationLessThan30MinutesAsync(Guid registeredCompaniesId, CancellationToken cancellationToken);

Task<IEnumerable<Domain.Models.Services>> GetServicesByCompanyIdAsync(Guid companyId, CancellationToken cancellationToken);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ public interface IAppointmentService : IGenericService<

Task<ResultT<RescheduleAppointmentDTos>> RescheduleAppointmentAsync(Guid appointmentId, RescheduleAppointmentDTos rescheduleAppointment, CancellationToken cancellationToken);

Task<ResultT<Guid>> ConfirmAppointmentAutomaticallyAsync(AppointmentStatus appointmentStatus, CancellationToken cancellationToken);
Task<ResultT<Guid>> ConfirmAppointmentAutomaticallyAsync(Guid appointmentId, CancellationToken cancellationToken);

Task<ResultT<Guid>> CancelAppointmentWithoutPenaltyAsync(Guid appointmentId, string cancellationReason, CancellationToken cancellationToken);

Task<ResultT<IEnumerable<AppointmentDTos>>> GetAvailableAppointmentsAsync(AppointmentDateFilterType filterType, CancellationToken cancellationToken);


Task<ResultT<int>> GetTotalAppointmentsCountAsync(Guid serviceId, CancellationToken cancellationToken);

Task<ResultT<AppointmentDTos>> ConfirmAppointment(Guid appointmentId, string confirmationCode, CancellationToken cancellationToken);
Task<ResultT<string>> CancelAppointmentWithPenaltyAsync(Guid appointmentId, double penalizationPorcentage ,CancellationToken cancellationToken);
Task<ResultT<ConfirmAppointmentDTos>> ConfirmAppointment(Guid appointmentId, string confirmationCode, CancellationToken cancellationToken);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Trimly.Core.Application.Interfaces.Service;

public interface ICodeConfirmationService
{
Task<string> GenerateCodeConfirmation(string emailAddress);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface IGenericService <TCreateDTo,TUpdateDTo,TResponseDTo>

Task<ResultT<TResponseDTo>> GetByIdAsync(Guid id, CancellationToken cancellationToken);

Task<ResultT<TResponseDTo>> CreateAsync(TCreateDTo entity, CancellationToken cancellationToken);
Task<ResultT<TResponseDTo>> CreateAsync(TCreateDTo entityCreateDTo, CancellationToken cancellationToken);

Task<ResultT<TResponseDTo>> UpdateAsync(Guid id, TUpdateDTo entity,CancellationToken cancellation);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface ISchedulesService : IGenericService<

Task<ResultT<IEnumerable<SchedulesDTos>>> FilterByOpeningTimeAsync(Guid registeredCompany, TimeOnly openingTime, CancellationToken cancellationToken);

Task<ResultT<IEnumerable<SchedulesDTos>>> FilterByIsHolidayAsync(Guid registeredCompany, CancellationToken cancellationToken);
Task<ResultT<IEnumerable<SchedulesDTos>>> FilterByIsHolidayAsync(Guid registeredCompany, Status isHoliday ,CancellationToken cancellationToken);

Task<ResultT<IEnumerable<SchedulesDTos>>> FilterByWeekDayAsync(Guid registeredCompany, Weekday weekday, CancellationToken cancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ public interface IServicesService : IGenericService<
UpdateServiceDTos,
ServicesDTos>
{
Task<ResultT<Guid>> ApplyDiscountCodeAsync(Guid serviceId,Guid registeredCompanyId, double discount, string discountCode, CancellationToken cancellationToken);
Task<ResultT<Guid>> ApplyDiscountCodeAsync(Guid serviceId,Guid registeredCompanyId, string discountCode, CancellationToken cancellationToken);

Task<ResultT<IEnumerable<ServiceFilterDTos>>> GetServicesWithDurationLessThan30MinutesAsync(Guid registeredCompany, CancellationToken cancellationToken);

Task<ResultT<IEnumerable<ServicesDTos>>> GetServicesByCompanyIdAsync(Guid registeredCompaniesId, CancellationToken cancellationToken);

Task<ResultT<IEnumerable<ServiceFilterDTos>>> GetServicesByNameAsync(string name, Guid registeredCompanyId, CancellationToken cancellationToken);

Task<ResultT<IEnumerable<ServiceFilterDTos>>> GetServicesByPriceAsync(double price, Guid registeredCompanyId, CancellationToken cancellationToken);
Task<ResultT<IEnumerable<ServiceFilterDTos>>> GetServicesByPriceAsync(decimal price, Guid registeredCompanyId, CancellationToken cancellationToken);
}
}
Loading