profileShare

rasmusjy / splitapp-backend-microservices

Read-only snapshot

No repository description.

main default branch 501 files Expires Sep 13, 2026, 9:06 AM
IAppUnitOfWork.cs 2,931 bytes
1 using SplitApp.Modules.Expenses.Domain.Entities;
2 using SplitApp.Modules.Trips.Domain.Entities;
3 using SplitApp.Shared.Kernel.Domain;
4 using SplitApp.Shared.Kernel.Persistence;
5
6 namespace SplitApp.WebApp.Application.Contracts;
7
8 /// <summary>
9 /// Composition-root unit-of-work facade. Aggregates the Trips and Expenses module
10 /// DbContexts so phase-2 BLL services keep working. Users are no longer in-process
11 /// (moved to SplitApp.UsersService) — user data is fetched via IUserLookup (RabbitMQ RPC).
12 /// </summary>
13 public interface IAppUnitOfWork : IUnitOfWork
14 {
15 ITripRepository Trips { get; }
16 IExpenseRepository Expenses { get; }
17 ITripParticipantRepository TripParticipants { get; }
18 ITripInvitationRepository TripInvitations { get; }
19 ISettlementPlanRepository SettlementPlans { get; }
20 ISettlementPaymentRepository SettlementPayments { get; }
21 ITripPollRepository TripPolls { get; }
22 ITripWishlistItemRepository TripWishlistItems { get; }
23 ISplitPresetRepository SplitPresets { get; }
24 IBudgetCategoryRepository BudgetCategories { get; }
25 IBaseRepository<TEntity> GetRepository<TEntity>() where TEntity : class, IBaseEntity;
26 }
27
28 public interface ITripRepository : IBaseRepository<Trip>
29 {
30 Task<IEnumerable<Trip>> GetUserTripsAsync(Guid userId);
31 Task<Trip?> GetByIdWithDetailsAsync(Guid id);
32 }
33
34 public interface IExpenseRepository : IBaseRepository<Expense>
35 {
36 Task<IEnumerable<Expense>> GetByTripIdAsync(Guid tripId);
37 Task<Expense?> GetByIdWithDetailsAsync(Guid id);
38 }
39
40 public interface ITripParticipantRepository : IBaseRepository<TripParticipant>
41 {
42 Task<bool> IsParticipantAsync(Guid tripId, Guid userId);
43 Task<bool> IsOrganizerAsync(Guid tripId, Guid userId);
44 Task<IEnumerable<TripParticipant>> GetByTripIdAsync(Guid tripId);
45 }
46
47 public interface ITripInvitationRepository : IBaseRepository<TripInvitation>
48 {
49 Task<TripInvitation?> GetByTokenAsync(string token);
50 Task<IEnumerable<TripInvitation>> GetPendingByTripIdAsync(Guid tripId);
51 }
52
53 public interface ISettlementPlanRepository : IBaseRepository<SettlementPlan>
54 {
55 Task<SettlementPlan?> GetLatestByTripIdAsync(Guid tripId);
56 Task DeletePlanWithPaymentsAsync(Guid planId);
57 }
58
59 public interface ISettlementPaymentRepository : IBaseRepository<SettlementPayment>
60 {
61 }
62
63 public interface ITripPollRepository : IBaseRepository<TripPoll>
64 {
65 Task<IEnumerable<TripPoll>> GetByTripIdAsync(Guid tripId);
66 Task<TripPoll?> GetByIdWithDetailsAsync(Guid id);
67 }
68
69 public interface ITripWishlistItemRepository : IBaseRepository<TripWishlistItem>
70 {
71 Task<IEnumerable<TripWishlistItem>> GetByTripIdAsync(Guid tripId);
72 }
73
74 public interface ISplitPresetRepository : IBaseRepository<SplitPreset>
75 {
76 Task<IEnumerable<SplitPreset>> GetByTripIdAsync(Guid tripId);
77 }
78
79 public interface IBudgetCategoryRepository : IBaseRepository<BudgetCategory>
80 {
81 Task<IEnumerable<BudgetCategory>> GetByTripIdAsync(Guid tripId);
82 }
83