diff --git a/src/EventHub.Application.Contracts/Organizations/FeatureOfPlanDefinitionDto.cs b/src/EventHub.Application.Contracts/Organizations/FeatureOfPlanDefinitionDto.cs index d4e1e0d..42cef87 100644 --- a/src/EventHub.Application.Contracts/Organizations/FeatureOfPlanDefinitionDto.cs +++ b/src/EventHub.Application.Contracts/Organizations/FeatureOfPlanDefinitionDto.cs @@ -4,7 +4,7 @@ namespace EventHub.Organizations; public class FeatureOfPlanDefinitionDto { - public uint? MaxAllowedEventsCount { get; set; } + public uint? MaxAllowedEventsCountInOneYear { get; set; } public uint? MaxAllowedTracksCountInOneEvent { get; set; } diff --git a/src/EventHub.Domain/Organizations/Plans/FeatureOfPlanDefinition.cs b/src/EventHub.Domain/Organizations/Plans/FeatureOfPlanDefinition.cs index c9724ac..c693856 100644 --- a/src/EventHub.Domain/Organizations/Plans/FeatureOfPlanDefinition.cs +++ b/src/EventHub.Domain/Organizations/Plans/FeatureOfPlanDefinition.cs @@ -8,7 +8,7 @@ public class FeatureOfPlanDefinition { [CanBeNull] [Range(0, uint.MaxValue, ErrorMessage = "Value for {0} must be between {1} and {2}.")] - public uint? MaxAllowedEventsCount { get; set; } + public uint? MaxAllowedEventsCountInOneYear { get; set; } [CanBeNull] [Range(0, uint.MaxValue, ErrorMessage = "Value for {0} must be between {1} and {2}.")] diff --git a/src/EventHub.Domain/Organizations/Plans/PlanFeatureManager.cs b/src/EventHub.Domain/Organizations/Plans/PlanFeatureManager.cs index db1bb07..6074015 100644 --- a/src/EventHub.Domain/Organizations/Plans/PlanFeatureManager.cs +++ b/src/EventHub.Domain/Organizations/Plans/PlanFeatureManager.cs @@ -30,9 +30,9 @@ public class PlanFeatureManager : ITransientDependency { var currentPlanOfOrganization = await GetCurrentPlanByOrganizationIdAsync(organizationId); - var totalEventCountByOrganization = await _eventRepository.CountAsync(x => x.OrganizationId == organizationId); + var totalEventCountByOrganization = await _eventRepository.CountAsync(x => x.OrganizationId == organizationId && x.CreationTime.Year < DateTime.Now.Year + 1 && x.CreationTime.Year > DateTime.Now.Year - 1); totalEventCountByOrganization++; - return currentPlanOfOrganization.Feature.MaxAllowedEventsCount >= totalEventCountByOrganization; + return currentPlanOfOrganization.Feature.MaxAllowedEventsCountInOneYear >= totalEventCountByOrganization; } public virtual async Task CanAddNewTrack(Event @event) diff --git a/src/EventHub.Domain/Organizations/Plans/PlanInfoDefinition.cs b/src/EventHub.Domain/Organizations/Plans/PlanInfoDefinition.cs index 459ceca..22043f1 100644 --- a/src/EventHub.Domain/Organizations/Plans/PlanInfoDefinition.cs +++ b/src/EventHub.Domain/Organizations/Plans/PlanInfoDefinition.cs @@ -36,7 +36,7 @@ public class PlanInfoDefinition { Feature = new FeatureOfPlanDefinition { - MaxAllowedEventsCount = uint.MaxValue, + MaxAllowedEventsCountInOneYear = uint.MaxValue, MaxAllowedTracksCountInOneEvent = uint.MaxValue, MaxAllowedAttendeesCountInOneEvent = uint.MaxValue, AdditionalFeatureInfos = new List() diff --git a/src/EventHub.HttpApi.Host/appsettings.json b/src/EventHub.HttpApi.Host/appsettings.json index 6de340b..34c8801 100644 --- a/src/EventHub.HttpApi.Host/appsettings.json +++ b/src/EventHub.HttpApi.Host/appsettings.json @@ -27,7 +27,7 @@ "Price": 0, "IsExtendable": false, "Feature": { - "MaxAllowedEventsCount": 2, + "MaxAllowedEventsCountInOneYear": 2, "MaxAllowedTracksCountInOneEvent": 2, "MaxAllowedAttendeesCountInOneEvent": 1000 } diff --git a/src/EventHub.Web/Pages/Pricing.cshtml b/src/EventHub.Web/Pages/Pricing.cshtml index 687b433..5aa1ed7 100644 --- a/src/EventHub.Web/Pages/Pricing.cshtml +++ b/src/EventHub.Web/Pages/Pricing.cshtml @@ -25,7 +25,7 @@ @plan.Price