Browse Source

Consider the year in the CanCreateNewEvent method

pull/90/head
berkansasmaz 5 years ago
parent
commit
6459dbe90a
No known key found for this signature in database GPG Key ID: 3AD81E2CA002230D
  1. 2
      src/EventHub.Application.Contracts/Organizations/FeatureOfPlanDefinitionDto.cs
  2. 2
      src/EventHub.Domain/Organizations/Plans/FeatureOfPlanDefinition.cs
  3. 4
      src/EventHub.Domain/Organizations/Plans/PlanFeatureManager.cs
  4. 2
      src/EventHub.Domain/Organizations/Plans/PlanInfoDefinition.cs
  5. 2
      src/EventHub.HttpApi.Host/appsettings.json
  6. 2
      src/EventHub.Web/Pages/Pricing.cshtml

2
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; }

2
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}.")]

4
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<bool> CanAddNewTrack(Event @event)

2
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<string>()

2
src/EventHub.HttpApi.Host/appsettings.json

@ -27,7 +27,7 @@
"Price": 0,
"IsExtendable": false,
"Feature": {
"MaxAllowedEventsCount": 2,
"MaxAllowedEventsCountInOneYear": 2,
"MaxAllowedTracksCountInOneEvent": 2,
"MaxAllowedAttendeesCountInOneEvent": 1000
}

2
src/EventHub.Web/Pages/Pricing.cshtml

@ -25,7 +25,7 @@
<span>@plan.Price</span>
</div>
<ul class="list-check-icon mb-4 text-start">
<li><i class="fa fa-check-circle"></i> @PlanInfoHelper.GetFeatureInfoByCount(plan.Feature.MaxAllowedEventsCount) events in a year. </li>
<li><i class="fa fa-check-circle"></i> @PlanInfoHelper.GetFeatureInfoByCount(plan.Feature.MaxAllowedEventsCountInOneYear) events in a year. </li>
<li><i class="fa fa-check-circle"></i> Up to @PlanInfoHelper.GetFeatureInfoByCount(plan.Feature.MaxAllowedTracksCountInOneEvent).ToLower() tracks for an event. </li>
<li><i class="fa fa-check-circle"></i> Up to @PlanInfoHelper.GetFeatureInfoByCount(plan.Feature.MaxAllowedAttendeesCountInOneEvent).ToLower() attendees per event. </li>
@foreach (var additionalFeatureInfo in plan.Feature.AdditionalFeatureInfos)

Loading…
Cancel
Save