Spaces:
Running
Running
Commit ·
0a579ad
1
Parent(s): 67d4c53
fix: treat null/empty SubscriptionTier as Free tier in all limit checks
Browse filesFiles changed (2)
143 unmodified lines144145146147147148149150151152153155 unmodified lines30931031130931231331431531631731883 unmodified lines402403404405406407399408409410411403412413414415143 unmodified lines var user = await _userRepo.GetByIdAsync(currentUserId); if (user == null) throw new Exception("User not found.");
if (user.SubscriptionTier == "Free") var tier = user.SubscriptionTier?.Trim(); bool isFree = string.IsNullOrEmpty(tier) || tier == "Free";
if (isFree) { var ownedGraphsCount = (await _repo.GetAllByUserIdAsync(currentUserId)).Count(); if (ownedGraphsCount >= 3)155 unmodified lines var user = await _userRepo.GetByIdAsync(currentUserId); if (user == null) throw new Exception("User not found.");
if (user.SubscriptionTier == "Free") var tier = user.SubscriptionTier?.Trim(); bool isFree = string.IsNullOrEmpty(tier) || tier == "Free";
if (isFree) { if (dto.Nodes.Count > 200) {83 unmodified lines var shares = await _sharedGraphRepo.GetSharesForGraphAsync(graphId); int currentSharedCount = shares?.Count() ?? 0;
var ownerTier = owner.SubscriptionTier?.Trim(); bool ownerIsFree = string.IsNullOrEmpty(ownerTier) || ownerTier == "Free";
if (owner.SubscriptionTier == "Free" && currentSharedCount >= 1) if (ownerIsFree && currentSharedCount >= 1) { throw new InvalidOperationException("Free tier is limited to 2 people on a board (1 guest)."); } else if (owner.SubscriptionTier == "Pro" && currentSharedCount >= 9) else if (ownerTier == "Pro" && currentSharedCount >= 9) { throw new InvalidOperationException("Pro tier is limited to 10 people on a board (9 guests)."); }31 unmodified lines323334353536373839404131 unmodified lines var existing = await _repo.GetRecordForDateAsync(dto.UserId, dto.HabitName, targetDate.Date); if (existing is not null) return MapToDto(existing);
if (user.SubscriptionTier == "Free") var tier = user.SubscriptionTier?.Trim(); bool isFree = string.IsNullOrEmpty(tier) || tier == "Free";
if (isFree) { var allRecords = await _repo.GetAllByUserIdAsync(dto.UserId); var distinctHabits = allRecords.Select(r => r.HabitName).Distinct().ToList();FlowAPI.Application/Services/GraphService.cs+13-4
FlowAPI.Application/Services/HabitService.cs+4-1