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 lines144145146147148149150155 unmodified lines30630730830931031131283 unmodified lines396397398399400401402403404405406143 unmodified linesvar user = await _userRepo.GetByIdAsync(currentUserId);if (user == null) throw new Exception("User not found.");if (user.SubscriptionTier == "Free"){var ownedGraphsCount = (await _repo.GetAllByUserIdAsync(currentUserId)).Count();if (ownedGraphsCount >= 3)155 unmodified linesvar user = await _userRepo.GetByIdAsync(currentUserId);if (user == null) throw new Exception("User not found.");if (user.SubscriptionTier == "Free"){if (dto.Nodes.Count > 200){83 unmodified linesvar shares = await _sharedGraphRepo.GetSharesForGraphAsync(graphId);int currentSharedCount = shares?.Count() ?? 0;if (owner.SubscriptionTier == "Free" && currentSharedCount >= 1){throw new InvalidOperationException("Free tier is limited to 2 people on a board (1 guest).");}else if (owner.SubscriptionTier == "Pro" && currentSharedCount >= 9){throw new InvalidOperationException("Pro tier is limited to 10 people on a board (9 guests).");}143 unmodified lines144145146147148149150151152153155 unmodified lines30931031131231331431531631731883 unmodified lines402403404405406407408409410411412413414415143 unmodified linesvar user = await _userRepo.GetByIdAsync(currentUserId);if (user == null) throw new Exception("User not found.");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 linesvar user = await _userRepo.GetByIdAsync(currentUserId);if (user == null) throw new Exception("User not found.");var tier = user.SubscriptionTier?.Trim();bool isFree = string.IsNullOrEmpty(tier) || tier == "Free";if (isFree){if (dto.Nodes.Count > 200){83 unmodified linesvar shares = await _sharedGraphRepo.GetSharesForGraphAsync(graphId);int currentSharedCount = shares?.Count() ?? 0;var ownerTier = owner.SubscriptionTier?.Trim();bool ownerIsFree = string.IsNullOrEmpty(ownerTier) || ownerTier == "Free";if (ownerIsFree && currentSharedCount >= 1){throw new InvalidOperationException("Free tier is limited to 2 people on a board (1 guest).");}else if (ownerTier == "Pro" && currentSharedCount >= 9){throw new InvalidOperationException("Pro tier is limited to 10 people on a board (9 guests).");}
31 unmodified lines3233343536373831 unmodified linesvar existing = await _repo.GetRecordForDateAsync(dto.UserId, dto.HabitName, targetDate.Date);if (existing is not null) return MapToDto(existing);if (user.SubscriptionTier == "Free"){var allRecords = await _repo.GetAllByUserIdAsync(dto.UserId);var distinctHabits = allRecords.Select(r => r.HabitName).Distinct().ToList();31 unmodified lines3233343536373839404131 unmodified linesvar existing = await _repo.GetRecordForDateAsync(dto.UserId, dto.HabitName, targetDate.Date);if (existing is not null) return MapToDto(existing);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