diff --git a/docs/IMPLEMENTATION_PLAN.md b/docs/IMPLEMENTATION_PLAN.md index 520c0c3..35ef9ff 100644 --- a/docs/IMPLEMENTATION_PLAN.md +++ b/docs/IMPLEMENTATION_PLAN.md @@ -326,7 +326,7 @@ NavMenu.razor: | ✓ | A1 | Foundation | Repository Interfaces | 5 Interface-Dateien | | ✓ | A2 | Foundation | Repository Implementations | 5 Repository-Dateien | | ✓ | A3 | Foundation | DTOs | 5 DTO-Dateien | -| ☐ | A4 | Foundation | Service Interfaces | 5 Service-Interface-Dateien | +| ✓ | A4 | Foundation | Service Interfaces | 5 Service-Interface-Dateien | | ☐ | A5 | Foundation | Service Implementations | 5 Service-Dateien | | ☐ | A6 | Foundation | AutoMapper Profiles | 5 Mapping-Dateien | | ☐ | A7 | Foundation | DI Registration | 2 DI-Dateien ändern | diff --git a/src/Koogle.Application/Interfaces/IClubService.cs b/src/Koogle.Application/Interfaces/IClubService.cs new file mode 100644 index 0000000..ee8c78b --- /dev/null +++ b/src/Koogle.Application/Interfaces/IClubService.cs @@ -0,0 +1,48 @@ +using Koogle.Application.DTOs; + +namespace Koogle.Application.Interfaces; + +/// +/// Service interface for managing club operations. +/// +public interface IClubService +{ + /// + /// Retrieves all clubs. Requires SuperAdmin role. + /// + /// Cancellation token. + /// A list of all clubs. + Task> GetAllAsync(CancellationToken ct = default); + + /// + /// Retrieves a club by its unique identifier. + /// + /// The unique identifier of the club. + /// Cancellation token. + /// The club if found; otherwise, null. + Task GetByIdAsync(Guid id, CancellationToken ct = default); + + /// + /// Creates a new club. Requires SuperAdmin role. + /// + /// The club creation data. + /// Cancellation token. + /// The created club. + Task CreateAsync(CreateClubDto dto, CancellationToken ct = default); + + /// + /// Updates an existing club. Requires SuperAdmin role. + /// + /// The club update data. + /// Cancellation token. + /// The updated club. + Task UpdateAsync(UpdateClubDto dto, CancellationToken ct = default); + + /// + /// Deletes a club. Requires SuperAdmin role. + /// + /// The unique identifier of the club to delete. + /// Cancellation token. + /// True if deleted successfully; otherwise, false. + Task DeleteAsync(Guid id, CancellationToken ct = default); +} diff --git a/src/Koogle.Application/Interfaces/IDayService.cs b/src/Koogle.Application/Interfaces/IDayService.cs index 2300572..787896a 100644 --- a/src/Koogle.Application/Interfaces/IDayService.cs +++ b/src/Koogle.Application/Interfaces/IDayService.cs @@ -1,14 +1,80 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Koogle.Application.DTOs; -namespace Koogle.Application.Interfaces +namespace Koogle.Application.Interfaces; + +/// +/// Service interface for managing game day operations. +/// +public interface IDayService { - public interface IDayService - { - Task> GetAllAsync(DayFilterDto filter, CancellationToken cancellationToken = default); - } + /// + /// Retrieves all days for the current club context with optional filtering. + /// + /// Optional filter criteria. + /// Cancellation token. + /// A paged result of day summaries. + Task> GetAllAsync(DayFilterDto? filter = null, CancellationToken ct = default); + + /// + /// Retrieves a day by its unique identifier with full details. + /// + /// The unique identifier of the day. + /// Cancellation token. + /// The day if found; otherwise, null. + Task GetByIdAsync(Guid id, CancellationToken ct = default); + + /// + /// Creates a new game day in the current club context. + /// + /// The day creation data. + /// Cancellation token. + /// The created day. + Task CreateAsync(CreateDayDto dto, CancellationToken ct = default); + + /// + /// Updates an existing game day. + /// + /// The day update data. + /// Cancellation token. + /// The updated day. + Task UpdateAsync(UpdateDayDto dto, CancellationToken ct = default); + + /// + /// Deletes a game day. + /// + /// The unique identifier of the day to delete. + /// Cancellation token. + /// True if deleted successfully; otherwise, false. + Task DeleteAsync(Guid id, CancellationToken ct = default); + + /// + /// Retrieves the active day (today) for the current club if exists. + /// + /// Cancellation token. + /// The active day if found; otherwise, null. + Task GetActiveDayAsync(CancellationToken ct = default); + + /// + /// Adds a participant to a game day. + /// + /// The participant addition data. + /// Cancellation token. + /// The updated day. + Task AddParticipantAsync(AddDayParticipantDto dto, CancellationToken ct = default); + + /// + /// Removes a participant from a game day. + /// + /// The participant removal data. + /// Cancellation token. + /// The updated day. + Task RemoveParticipantAsync(RemoveDayParticipantDto dto, CancellationToken ct = default); + + /// + /// Changes the status of a game day following the workflow: New → Started → Closed. + /// + /// The unique identifier of the day. + /// Cancellation token. + /// The updated day. + Task AdvanceStatusAsync(Guid id, CancellationToken ct = default); } diff --git a/src/Koogle.Application/Interfaces/IExpenseService.cs b/src/Koogle.Application/Interfaces/IExpenseService.cs new file mode 100644 index 0000000..b996895 --- /dev/null +++ b/src/Koogle.Application/Interfaces/IExpenseService.cs @@ -0,0 +1,55 @@ +using Koogle.Application.DTOs; + +namespace Koogle.Application.Interfaces; + +/// +/// Service interface for managing expense template operations. +/// +public interface IExpenseService +{ + /// + /// Retrieves all expense templates for the current club context. + /// + /// Cancellation token. + /// A list of expense templates. + Task> GetAllAsync(CancellationToken ct = default); + + /// + /// Retrieves an expense template by its unique identifier. + /// + /// The unique identifier of the expense. + /// Cancellation token. + /// The expense if found; otherwise, null. + Task GetByIdAsync(Guid id, CancellationToken ct = default); + + /// + /// Creates a new expense template in the current club context. + /// + /// The expense creation data. + /// Cancellation token. + /// The created expense. + Task CreateAsync(CreateExpenseDto dto, CancellationToken ct = default); + + /// + /// Updates an existing expense template. + /// + /// The expense update data. + /// Cancellation token. + /// The updated expense. + Task UpdateAsync(UpdateExpenseDto dto, CancellationToken ct = default); + + /// + /// Deletes an expense template. + /// + /// The unique identifier of the expense to delete. + /// Cancellation token. + /// True if deleted successfully; otherwise, false. + Task DeleteAsync(Guid id, CancellationToken ct = default); + + /// + /// Retrieves all one-click expense templates for quick access. + /// + /// Cancellation token. + /// A list of one-click expenses. + Task> GetOneClickExpensesAsync(CancellationToken ct = default); +} diff --git a/src/Koogle.Application/Interfaces/IPersonExpenseService.cs b/src/Koogle.Application/Interfaces/IPersonExpenseService.cs new file mode 100644 index 0000000..b02c155 --- /dev/null +++ b/src/Koogle.Application/Interfaces/IPersonExpenseService.cs @@ -0,0 +1,81 @@ +using Koogle.Application.DTOs; + +namespace Koogle.Application.Interfaces; + +/// +/// Service interface for managing person expense assignment operations. +/// +public interface IPersonExpenseService +{ + /// + /// Retrieves all expenses for a specific day. + /// + /// The unique identifier of the day. + /// Cancellation token. + /// A list of person expenses for the day. + Task> GetByDayIdAsync(Guid dayId, CancellationToken ct = default); + + /// + /// Retrieves all expenses for a specific person. + /// + /// The unique identifier of the person. + /// Cancellation token. + /// A list of person expenses. + Task> GetByPersonIdAsync(Guid personId, CancellationToken ct = default); + + /// + /// Retrieves a person expense by its unique identifier. + /// + /// The unique identifier of the person expense. + /// Cancellation token. + /// The person expense if found; otherwise, null. + Task GetByIdAsync(Guid id, CancellationToken ct = default); + + /// + /// Creates a new person expense assignment. + /// + /// The person expense creation data. + /// Cancellation token. + /// The created person expense. + Task CreateAsync(CreatePersonExpenseDto dto, CancellationToken ct = default); + + /// + /// Creates inverse expenses (charged to all participants except one person). + /// + /// The inverse expense creation data. + /// Cancellation token. + /// A list of created person expenses. + Task> CreateInverseAsync(CreateInversePersonExpenseDto dto, CancellationToken ct = default); + + /// + /// Updates the status of a person expense (Open/Done). + /// + /// The status update data. + /// Cancellation token. + /// The updated person expense. + Task UpdateStatusAsync(UpdatePersonExpenseStatusDto dto, CancellationToken ct = default); + + /// + /// Deletes a person expense. Only allowed when day status is New or Started. + /// + /// The unique identifier of the person expense to delete. + /// Cancellation token. + /// True if deleted successfully; otherwise, false. + Task DeleteAsync(Guid id, CancellationToken ct = default); + + /// + /// Gets the evaluation summary for a specific day. + /// + /// The unique identifier of the day. + /// Cancellation token. + /// The day evaluation summary. + Task GetDayEvaluationAsync(Guid dayId, CancellationToken ct = default); + + /// + /// Gets the evaluation summary for a specific person. + /// + /// The unique identifier of the person. + /// Cancellation token. + /// The person evaluation summary. + Task GetPersonEvaluationAsync(Guid personId, CancellationToken ct = default); +} diff --git a/src/Koogle.Application/Interfaces/IPersonService.cs b/src/Koogle.Application/Interfaces/IPersonService.cs new file mode 100644 index 0000000..6d3798f --- /dev/null +++ b/src/Koogle.Application/Interfaces/IPersonService.cs @@ -0,0 +1,62 @@ +using Koogle.Application.DTOs; + +namespace Koogle.Application.Interfaces; + +/// +/// Service interface for managing person (member/guest) operations. +/// +public interface IPersonService +{ + /// + /// Retrieves all persons for the current club context. + /// + /// Cancellation token. + /// A list of persons in the current club. + Task> GetAllAsync(CancellationToken ct = default); + + /// + /// Retrieves a person by its unique identifier. + /// + /// The unique identifier of the person. + /// Cancellation token. + /// The person if found; otherwise, null. + Task GetByIdAsync(Guid id, CancellationToken ct = default); + + /// + /// Creates a new person in the current club context. + /// + /// The person creation data. + /// Cancellation token. + /// The created person. + Task CreateAsync(CreatePersonDto dto, CancellationToken ct = default); + + /// + /// Updates an existing person. + /// + /// The person update data. + /// Cancellation token. + /// The updated person. + Task UpdateAsync(UpdatePersonDto dto, CancellationToken ct = default); + + /// + /// Deletes a person. + /// + /// The unique identifier of the person to delete. + /// Cancellation token. + /// True if deleted successfully; otherwise, false. + Task DeleteAsync(Guid id, CancellationToken ct = default); + + /// + /// Retrieves all members (excluding guests) for the current club. + /// + /// Cancellation token. + /// A list of members. + Task> GetMembersAsync(CancellationToken ct = default); + + /// + /// Retrieves all guests for the current club. + /// + /// Cancellation token. + /// A list of guests. + Task> GetGuestsAsync(CancellationToken ct = default); +} diff --git a/src/Koogle.Application/Services/DayService.cs b/src/Koogle.Application/Services/DayService.cs index aa55a6b..3997d34 100644 --- a/src/Koogle.Application/Services/DayService.cs +++ b/src/Koogle.Application/Services/DayService.cs @@ -27,7 +27,7 @@ namespace Koogle.Application.Services private readonly ICurrentUserService _currentUserService = currentUserService; private readonly IAuthorizationService _authorizationService = authorizationService; - public async Task> GetAllAsync(DayFilterDto filter, CancellationToken cancellationToken = default) + public async Task> GetAllAsync(DayFilterDto? filter = null, CancellationToken cancellationToken = default) { await using var context = await contextFactory.CreateDbContextAsync(cancellationToken); @@ -38,7 +38,8 @@ namespace Koogle.Application.Services .AsQueryable(); // Filter anwenden - query = ApplyFilters(query, filter); + if (filter != null) + query = ApplyFilters(query, filter); // Gesamtanzahl ermitteln var totalCount = await query.CountAsync(cancellationToken); @@ -130,5 +131,37 @@ namespace Koogle.Application.Services return query; } + + /// + public Task GetByIdAsync(Guid id, CancellationToken ct = default) + => throw new NotImplementedException("Will be implemented in Phase A5"); + + /// + public Task CreateAsync(CreateDayDto dto, CancellationToken ct = default) + => throw new NotImplementedException("Will be implemented in Phase A5"); + + /// + public Task UpdateAsync(UpdateDayDto dto, CancellationToken ct = default) + => throw new NotImplementedException("Will be implemented in Phase A5"); + + /// + public Task DeleteAsync(Guid id, CancellationToken ct = default) + => throw new NotImplementedException("Will be implemented in Phase A5"); + + /// + public Task GetActiveDayAsync(CancellationToken ct = default) + => throw new NotImplementedException("Will be implemented in Phase A5"); + + /// + public Task AddParticipantAsync(AddDayParticipantDto dto, CancellationToken ct = default) + => throw new NotImplementedException("Will be implemented in Phase A5"); + + /// + public Task RemoveParticipantAsync(RemoveDayParticipantDto dto, CancellationToken ct = default) + => throw new NotImplementedException("Will be implemented in Phase A5"); + + /// + public Task AdvanceStatusAsync(Guid id, CancellationToken ct = default) + => throw new NotImplementedException("Will be implemented in Phase A5"); } }