Files
Core_Be/Interfaces/ICustomerRepository.cs
T
HarithaRandunu 51f0021e27 feat: Enhance booking functionality with invoice management and dashboard summary
- Added customerId to guest booking requests for better identification.
- Implemented new endpoints for managing booking invoices and dashboard summaries.
- Created BookingInvoice and BookingDashboardSummary DTOs to support new features.
- Updated Booking and BookingInvoice models to include payment method and timestamps.
- Enhanced BookingService to handle invoice creation upon payment confirmation.
- Modified BookingRepository to support CRUD operations for BookingInvoice.
- Updated TenantDbContext to include BookingInvoice DbSet and relevant configurations.
- Improved error handling and validation for booking completion and payment processes.
2026-10-01 03:46:03 +05:30

80 lines
5.2 KiB
C#

using Fitness_core_BE.DTOs.Meal;
using Fitness_core_BE.DTOs.Workout;
using Fitness_core_BE.Models;
namespace Fitness_core_BE.Interfaces
{
public interface ICustomerRepository
{
Task<Customer?> GetCustomerById(Guid customerId);
// Central dedupe lookup: is this phone/email an existing Customer (active or not)?
// Matches on Customer's own PrimaryPH/SecondaryPH/Email as well as the linked User's
// PhoneNumber/Email, and deliberately does not filter by IsActive — an inactive
// customer's identity still counts as "already exists" so no duplicate central
// record gets created for the same person.
Task<Customer?> GetCustomerByIdentifier(string identifier);
Task<Customer> CreateCustomer(Customer customer);
Task<Customer?> UpdateCustomer(Guid customerId, Customer customer);
/// <summary>
/// Ensures this tenant DB has the TenantCustomerLink anchor row every tenant-side
/// FK (subscriptions, cards, attendance, ...) points at. Idempotent: refreshes the
/// cached display fields and re-activates the link when the row already exists, so
/// it is safe to call on both first-time creation and re-enrolment.
/// </summary>
Task EnsureTenantCustomerLink(Customer customer);
// Own-gym duplicate check: does THIS tenant already have an active customer whose
// cached phone/email matches? Scoped by construction (TenantDbContext is already this
// gym's own schema) -- no clientId parameter needed.
Task<TenantCustomerLink?> FindActiveLinkByIdentifierAsync(string identifier);
// Staff picking an existing member to link a walk-in booking to -- identification only.
Task<TenantCustomerLink?> GetTenantCustomerLinkById(Guid id);
Task<bool> DeleteCustomer(Guid customerId);
// Client-initiated delete: deactivates only this customer's presence at the calling
// client's gym (subscriptions/members/plan assignments scoped to clientId). The shared
// central Customer record is never touched — the same person may be an active member
// at a different gym.
Task<bool> DeactivateCustomerForClient(Guid customerId, Guid clientId);
Task<List<ClientBusiness>> GetAllClentShopsAsync();
Task<Guid?> GetCustomerClientId(Guid customerId);
Task<MealPlan?> GetActiveMealPlanAsync(Guid? clientId = null, Guid? cusId = null);
Task<WorkoutPlan?> GetActiveWorkOutAsync(Guid? clientId = null, Guid? cusId = null);
Task<List<MealPlanDetailDto>> GetFollowedMealPlansByCustomerIdAsync(Guid customerId);
// All of the customer's own AI-generated meal plans (IsTemplate=false), regardless of
// whether they're currently followed — distinct from admin/client-authored templates.
Task<List<MealPlanDetailDto>> GetMyMealPlansByCustomerIdAsync(Guid customerId);
Task<MealPlanDetailDto?> GetMealPlanByIdForCustomerAsync(Guid mealPlanId);
Task<List<WorkoutPlanDetailDto>> GetFollowedWorkoutPlansByCustomerIdAsync(Guid customerId);
Task<List<WorkoutPlanDetailDto>> GetMyWorkoutPlansByCustomerIdAsync(Guid customerId);
Task<WorkoutPlanDetailDto?> GetWorkoutPlanByIdForCustomerAsync(Guid workoutPlanId, Guid customerId);
Task<object> FollowMealPlan(Guid customerId, Guid mealPlanId);
Task<object> FollowWorkoutPlan(Guid customerId, Guid workOutPlanId);
// Active (IsActive) CustomerWorkout join row for this customer + plan, regardless of
// whether it's the currently-followed one — used to scope per-exercise completion.
Task<CustomerWorkout?> GetActiveCustomerWorkoutAsync(Guid customerId, Guid workoutPlanId);
Task SetExerciseCompletionAsync(Guid customerWorkoutId, Guid workoutExerciseId, bool completed);
Task<object> GetClientBizDataAsync(Guid ClientBizId);
Task<CustomerHealth> GetCusHealthRec(Guid cusID);
Task<List<CustomerTarget>> GetCusProgressRec(Guid cusID);
Task<object> CreateCusHealthRecAsync(CustomerHealth customerHealth);
Task<object> UpdateCusHealthRecAsync(CustomerHealth NewcustomerHealth);
Task<object> CreateCustomerTargetAsync(CustomerTarget customerTarget);
Task<CustomerTarget?> GetLatestCustomerTargetAsync(Guid customerId);
Task<List<CustomerTarget>> GetCustomerTargetsAsync(Guid customerId);
Task<CustomerTarget> UpdateLatestCustomerTargetNutritionsAsync(Guid customerId, string predictedNutritionsJson);
Task<Dictionary<string, List<CustomerTarget>>> GetCustomerProgressGroupedByGoalAsync(Guid customerId);
Task<CusWeightLossProgress> UpdateWeeklyProgressAsync(Guid customerId, Guid customerTargetId, decimal weight, DateTime? recordedAt);
Task<List<CusWeightLossProgress>> GetWeeklyProgressForCustomerAsync(Guid customerId, Guid customerTargetId);
Task<bool> VerifyCustomer(Guid userId, string type, string identifire);
Task<bool> IsverifiedCus(Guid cusId);
Task<List<CustomerCards>> GetCardsByCustomerIdAsync(Guid customerId, CancellationToken ct = default);
Task<CustomerCards?> GetCardByIdAsync(Guid cardId, CancellationToken ct = default);
Task<CustomerCards> AddCardAsync(CustomerCards card, CancellationToken ct = default);
}
}