From d5ff02833517d311b395e76cdbb0e71783740c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 17 Jul 2021 12:57:19 +0300 Subject: [PATCH 01/44] Introduced tracks, sesions and speakers. --- .../EventHubErrorCodes.cs | 1 + .../Events/SessionConsts.cs | 14 ++++ .../Events/TrackConsts.cs | 7 ++ .../Localization/EventHub/en.json | 3 +- src/EventHub.Domain/Events/Event.cs | 7 ++ src/EventHub.Domain/Events/Session.cs | 70 +++++++++++++++++++ src/EventHub.Domain/Events/Speaker.cs | 23 ++++++ src/EventHub.Domain/Events/Track.cs | 39 +++++++++++ 8 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 src/EventHub.Domain.Shared/Events/SessionConsts.cs create mode 100644 src/EventHub.Domain.Shared/Events/TrackConsts.cs create mode 100644 src/EventHub.Domain/Events/Session.cs create mode 100644 src/EventHub.Domain/Events/Speaker.cs create mode 100644 src/EventHub.Domain/Events/Track.cs diff --git a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs index 4b4bccd..c92a112 100644 --- a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs +++ b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs @@ -5,6 +5,7 @@ public const string OrganizationNameAlreadyExists = "EventHub:OrganizationNameAlreadyExists"; public const string NotAuthorizedToCreateEventInThisOrganization = "EventHub:NotAuthorizedToCreateEventInThisOrganization"; public const string EventEndTimeCantBeEarlierThanStartTime = "EventHub:EventEndTimeCantBeEarlierThanStartTime"; + public const string SessionEndTimeCantBeEarlierThanStartTime = "EventHub:SessionEndTimeCantBeEarlierThanStartTime"; public const string CantRegisterOrUnregisterForAPastEvent = "EventHub:CantRegisterOrUnregisterForAPastEvent"; public const string NotAuthorizedToUpdateOrganizationProfile = "EventHub:NotAuthorizedToUpdateOrganizationProfile"; public const string CapacityOfEventFull = "EventHub:CapacityOfEventFull"; diff --git a/src/EventHub.Domain.Shared/Events/SessionConsts.cs b/src/EventHub.Domain.Shared/Events/SessionConsts.cs new file mode 100644 index 0000000..8f7e304 --- /dev/null +++ b/src/EventHub.Domain.Shared/Events/SessionConsts.cs @@ -0,0 +1,14 @@ +namespace EventHub.Events +{ + public class SessionConsts + { + public const int MinTitleLength = 8; + public const int MaxTitleLength = 128; + + public const int MinDescriptionLength = 50; + public const int MaxDescriptionLength = 2000; + + public const int MinLanguageLength = 2; + public const int MaxLanguageLength = 16; + } +} \ No newline at end of file diff --git a/src/EventHub.Domain.Shared/Events/TrackConsts.cs b/src/EventHub.Domain.Shared/Events/TrackConsts.cs new file mode 100644 index 0000000..71b1de5 --- /dev/null +++ b/src/EventHub.Domain.Shared/Events/TrackConsts.cs @@ -0,0 +1,7 @@ +namespace EventHub.Events +{ + public class TrackConsts + { + public const int MaxNameLength = 64; + } +} \ No newline at end of file diff --git a/src/EventHub.Domain.Shared/Localization/EventHub/en.json b/src/EventHub.Domain.Shared/Localization/EventHub/en.json index fa2b05b..0aca53c 100644 --- a/src/EventHub.Domain.Shared/Localization/EventHub/en.json +++ b/src/EventHub.Domain.Shared/Localization/EventHub/en.json @@ -82,6 +82,7 @@ "EventTimingPreview": "Event Timing Preview", "CoverImagePreview": "Cover Image Preview", "EventTimingChangeSuccessMessage": "The time of the event has been changed successfully!", - "PastEvent": "Past Event" + "PastEvent": "Past Event", + "EventHub:SessionEndTimeCantBeEarlierThanStartTime": "Session end time can not be earlier than the start time." } } diff --git a/src/EventHub.Domain/Events/Event.cs b/src/EventHub.Domain/Events/Event.cs index eb6a386..6011a69 100644 --- a/src/EventHub.Domain/Events/Event.cs +++ b/src/EventHub.Domain/Events/Event.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; using Volo.Abp; using Volo.Abp.Domain.Entities.Auditing; @@ -41,6 +43,8 @@ namespace EventHub.Events public int TimingChangeCount { get; set; } public bool IsTimingChangeEmailSent { get; set; } + + public ICollection Tracks { get; private set; } private Event() { @@ -59,9 +63,12 @@ namespace EventHub.Events { OrganizationId = organizationId; UrlCode = Check.NotNullOrWhiteSpace(urlCode, urlCode, EventConsts.UrlCodeLength, EventConsts.UrlCodeLength); + SetTitle(title); SetDescription(description); SetTimeInternal(startTime, endTime); + + Tracks = new Collection(); } public Event SetTitle(string title) diff --git a/src/EventHub.Domain/Events/Session.cs b/src/EventHub.Domain/Events/Session.cs new file mode 100644 index 0000000..2b6f539 --- /dev/null +++ b/src/EventHub.Domain/Events/Session.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Volo.Abp; +using Volo.Abp.Domain.Entities; + +namespace EventHub.Events +{ + public class Session : Entity + { + public Guid TrackId { get; private set; } + + public string Title { get; private set; } + + public DateTime StartTime { get; private set; } + + public DateTime EndTime { get; private set; } + + public string Description { get; private set; } + + public string Language { get; set; } + + public ICollection Speakers { get; private set; } + + private Session() + { + + } + + internal Session( + Guid id, + Guid trackId, + string title, + DateTime startTime, + DateTime endTime, + string description) + : base(id) + { + TrackId = trackId; + SetTitle(title); + SetDescription(description); + SetTime(startTime, endTime); + Speakers = new Collection(); + } + + public Session SetTitle(string title) + { + Title = Check.NotNullOrWhiteSpace(title, nameof(title), SessionConsts.MaxTitleLength, SessionConsts.MinTitleLength); + return this; + } + + public Session SetDescription(string description) + { + Description = Check.NotNullOrWhiteSpace(description, nameof(description), SessionConsts.MaxDescriptionLength, SessionConsts.MinDescriptionLength); + return this; + } + + internal Session SetTime(DateTime startTime, DateTime endTime) + { + if (startTime > endTime) + { + throw new BusinessException(EventHubErrorCodes.SessionEndTimeCantBeEarlierThanStartTime); + } + + StartTime = startTime; + EndTime = endTime; + return this; + } + } +} \ No newline at end of file diff --git a/src/EventHub.Domain/Events/Speaker.cs b/src/EventHub.Domain/Events/Speaker.cs new file mode 100644 index 0000000..f978562 --- /dev/null +++ b/src/EventHub.Domain/Events/Speaker.cs @@ -0,0 +1,23 @@ +using System; +using Volo.Abp.Domain.Entities; + +namespace EventHub.Events +{ + public class Speaker : Entity + { + public Guid SessionId { get; private set; } + + public Guid UserId { get; private set; } + + public Speaker(Guid sessionId, Guid userId) + { + SessionId = sessionId; + UserId = userId; + } + + public override object[] GetKeys() + { + return new object[] {SessionId, UserId}; + } + } +} \ No newline at end of file diff --git a/src/EventHub.Domain/Events/Track.cs b/src/EventHub.Domain/Events/Track.cs new file mode 100644 index 0000000..908308f --- /dev/null +++ b/src/EventHub.Domain/Events/Track.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Volo.Abp; +using Volo.Abp.Domain.Entities; + +namespace EventHub.Events +{ + public class Track : Entity + { + public Guid EventId { get; private set; } + + public string Name { get; private set; } + + public ICollection Sessions { get; private set; } + + private Track() + { + + } + + internal Track( + Guid id, + Guid eventId, + string name) + : base(id) + { + EventId = eventId; + Name = name; + Sessions = new Collection(); + } + + public Track SetName(string name) + { + Name = Check.NotNullOrWhiteSpace(name, nameof(name), TrackConsts.MaxNameLength); + return this; + } + } +} \ No newline at end of file From 5393cdea9058dfa3dc8d23f6d0553fe98ee232b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sun, 18 Jul 2021 11:31:35 +0300 Subject: [PATCH 02/44] Added IsDraft and revised setting the time. --- src/EventHub.Domain/Events/Event.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/EventHub.Domain/Events/Event.cs b/src/EventHub.Domain/Events/Event.cs index 6011a69..9c9314f 100644 --- a/src/EventHub.Domain/Events/Event.cs +++ b/src/EventHub.Domain/Events/Event.cs @@ -44,6 +44,8 @@ namespace EventHub.Events public bool IsTimingChangeEmailSent { get; set; } + public bool IsDraft { get; set; } + public ICollection Tracks { get; private set; } private Event() @@ -97,9 +99,10 @@ namespace EventHub.Events .WithData("MaxTimingChangeLimit", EventConsts.MaxTimingChangeCountForUser); } + SetTimeInternal(startTime, endTime); + TimingChangeCount++; AddLocalEvent(new EventTimeChangingEventData(this, StartTime, EndTime)); - - return SetTimeInternal(startTime, endTime); + return this; } private Event SetTimeInternal(DateTime startTime, DateTime endTime) @@ -111,7 +114,6 @@ namespace EventHub.Events StartTime = startTime; EndTime = endTime; - TimingChangeCount++; return this; } } From c6d8f5a896e3919db9f3993d5417220f0df71712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sun, 18 Jul 2021 15:27:58 +0300 Subject: [PATCH 03/44] AddSession method on the Event --- .../Events/IEventAppService.cs | 17 +++++++++++++++++ .../Events/EventAppService.cs | 16 +++++++++++++++- src/EventHub.Domain/Events/Event.cs | 5 +++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/EventHub.Application.Contracts/Events/IEventAppService.cs b/src/EventHub.Application.Contracts/Events/IEventAppService.cs index dd253d3..047c1e5 100644 --- a/src/EventHub.Application.Contracts/Events/IEventAppService.cs +++ b/src/EventHub.Application.Contracts/Events/IEventAppService.cs @@ -22,6 +22,23 @@ namespace EventHub.Events Task UpdateAsync(Guid id, UpdateEventDto input); + Task AddSessionAsync(Guid id, AddSessionDto input); + Task GetCoverImageAsync(Guid id); } + + public class AddSessionDto + { + public Guid TrackId { get; set; } + + public string Title { get; set; } + + public DateTime StartTime { get; set; } + + public DateTime EndTime { get; set; } + + public string Description { get; set; } + + public string Language { get; set; } + } } diff --git a/src/EventHub.Application/Events/EventAppService.cs b/src/EventHub.Application/Events/EventAppService.cs index 2bf29cb..78e5194 100644 --- a/src/EventHub.Application/Events/EventAppService.cs +++ b/src/EventHub.Application/Events/EventAppService.cs @@ -261,7 +261,21 @@ namespace EventHub.Events await _eventRepository.UpdateAsync(@event); } - + + public async Task AddSessionAsync(Guid id, AddSessionDto input) + { + var @event = await _eventRepository.GetAsync(id); + @event.AddSession( + input.TrackId, + input.Title, + input.StartTime, + input.EndTime, + input.Description, + input.Language + ); + await _eventRepository.UpdateAsync(@event); + } + public async Task GetCoverImageAsync(Guid id) { var blobName = id.ToString(); diff --git a/src/EventHub.Domain/Events/Event.cs b/src/EventHub.Domain/Events/Event.cs index 9c9314f..87eeca4 100644 --- a/src/EventHub.Domain/Events/Event.cs +++ b/src/EventHub.Domain/Events/Event.cs @@ -116,5 +116,10 @@ namespace EventHub.Events EndTime = endTime; return this; } + + public void AddSession(Guid trackId, string title, DateTime startTime, DateTime endTime, string description, string language) + { + throw new NotImplementedException(); + } } } From ccb3a7f26e790f23dd23b4dbe916c22d48d03ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 22 Jul 2021 11:59:56 +0300 Subject: [PATCH 04/44] Refactored --- .../Events/EventAppService.cs | 1 + .../EventHubErrorCodes.cs | 4 +- .../Data/EventHubDataSeedContributor.cs | 1 + src/EventHub.Domain/Events/Event.cs | 56 +++++++++++++++---- .../EventTimeChangeLocalEventHandler.cs | 30 ---------- .../Events/EventTimeChangingEventData.cs | 18 ------ src/EventHub.Domain/Events/Track.cs | 27 +++++++++ .../Events/EventTests.cs | 2 +- 8 files changed, 78 insertions(+), 61 deletions(-) delete mode 100644 src/EventHub.Domain/Events/EventTimeChangeLocalEventHandler.cs delete mode 100644 src/EventHub.Domain/Events/EventTimeChangingEventData.cs diff --git a/src/EventHub.Application/Events/EventAppService.cs b/src/EventHub.Application/Events/EventAppService.cs index 78e5194..e98c016 100644 --- a/src/EventHub.Application/Events/EventAppService.cs +++ b/src/EventHub.Application/Events/EventAppService.cs @@ -267,6 +267,7 @@ namespace EventHub.Events var @event = await _eventRepository.GetAsync(id); @event.AddSession( input.TrackId, + GuidGenerator.Create(), input.Title, input.StartTime, input.EndTime, diff --git a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs index c92a112..8268063 100644 --- a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs +++ b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs @@ -4,7 +4,7 @@ { public const string OrganizationNameAlreadyExists = "EventHub:OrganizationNameAlreadyExists"; public const string NotAuthorizedToCreateEventInThisOrganization = "EventHub:NotAuthorizedToCreateEventInThisOrganization"; - public const string EventEndTimeCantBeEarlierThanStartTime = "EventHub:EventEndTimeCantBeEarlierThanStartTime"; + public const string EndTimeCantBeEarlierThanStartTime = "EventHub:EndTimeCantBeEarlierThanStartTime"; public const string SessionEndTimeCantBeEarlierThanStartTime = "EventHub:SessionEndTimeCantBeEarlierThanStartTime"; public const string CantRegisterOrUnregisterForAPastEvent = "EventHub:CantRegisterOrUnregisterForAPastEvent"; public const string NotAuthorizedToUpdateOrganizationProfile = "EventHub:NotAuthorizedToUpdateOrganizationProfile"; @@ -12,5 +12,7 @@ public const string CapacityCantBeLowerThanRegisteredUserCount = "EventHub:CapacityCantBeLowerThanRegisteredUserCount"; public const string NotAuthorizedToUpdateEvent = "EventHub:NotAuthorizedToUpdateEvent"; public const string CantChangeEventTiming = "EventHub:CantChangeEventTiming"; + public const string SessionTimeShouldBeInTheEventTime = "EventHub:SessionTimeShouldBeInTheEventTime"; + public const string SessionTimeConflictsWithAnExistingSession = "EventHub:SessionTimeConflictsWithAnExistingSession"; } } diff --git a/src/EventHub.Domain/Data/EventHubDataSeedContributor.cs b/src/EventHub.Domain/Data/EventHubDataSeedContributor.cs index 29e9daf..b58a6e5 100644 --- a/src/EventHub.Domain/Data/EventHubDataSeedContributor.cs +++ b/src/EventHub.Domain/Data/EventHubDataSeedContributor.cs @@ -32,6 +32,7 @@ namespace EventHub.Data var countries = new List { + //TODO: Use IGuidGenerator new Country(Guid.NewGuid(), "Afghanistan"), new Country(Guid.NewGuid(), "Albania"), new Country(Guid.NewGuid(), "Algeria"), diff --git a/src/EventHub.Domain/Events/Event.cs b/src/EventHub.Domain/Events/Event.cs index 87eeca4..9cc860c 100644 --- a/src/EventHub.Domain/Events/Event.cs +++ b/src/EventHub.Domain/Events/Event.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Linq; using Volo.Abp; +using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; namespace EventHub.Events @@ -45,9 +47,8 @@ namespace EventHub.Events public bool IsTimingChangeEmailSent { get; set; } public bool IsDraft { get; set; } - public ICollection Tracks { get; private set; } - + private Event() { @@ -92,16 +93,24 @@ namespace EventHub.Events { return this; } - - if (TimingChangeCount >= EventConsts.MaxTimingChangeCountForUser) + + if (!IsDraft) { - throw new BusinessException(EventHubErrorCodes.CantChangeEventTiming) - .WithData("MaxTimingChangeLimit", EventConsts.MaxTimingChangeCountForUser); + if (TimingChangeCount >= EventConsts.MaxTimingChangeCountForUser) + { + throw new BusinessException(EventHubErrorCodes.CantChangeEventTiming) + .WithData("MaxTimingChangeLimit", EventConsts.MaxTimingChangeCountForUser); + } } SetTimeInternal(startTime, endTime); - TimingChangeCount++; - AddLocalEvent(new EventTimeChangingEventData(this, StartTime, EndTime)); + + if (!IsDraft) + { + TimingChangeCount++; + IsTimingChangeEmailSent = false; + } + return this; } @@ -109,7 +118,7 @@ namespace EventHub.Events { if (startTime > endTime) { - throw new BusinessException(EventHubErrorCodes.EventEndTimeCantBeEarlierThanStartTime); + throw new BusinessException(EventHubErrorCodes.EndTimeCantBeEarlierThanStartTime); } StartTime = startTime; @@ -117,9 +126,34 @@ namespace EventHub.Events return this; } - public void AddSession(Guid trackId, string title, DateTime startTime, DateTime endTime, string description, string language) + public Event AddSession( + Guid trackId, + Guid sessionId, + string title, + DateTime startTime, + DateTime endTime, + string description, + string language) + { + if (startTime > endTime) + { + throw new BusinessException(EventHubErrorCodes.EndTimeCantBeEarlierThanStartTime); + } + + if (startTime < this.StartTime || this.EndTime < endTime) + { + throw new BusinessException(EventHubErrorCodes.SessionTimeShouldBeInTheEventTime); + } + + var track = GetTrack(trackId); + track.AddSession(sessionId, title, startTime, endTime, description, language); + return this; + } + + private Track GetTrack(Guid trackId) { - throw new NotImplementedException(); + return Tracks.FirstOrDefault(t => t.Id == trackId) ?? + throw new EntityNotFoundException(typeof(Track), trackId); } } } diff --git a/src/EventHub.Domain/Events/EventTimeChangeLocalEventHandler.cs b/src/EventHub.Domain/Events/EventTimeChangeLocalEventHandler.cs deleted file mode 100644 index 492a64d..0000000 --- a/src/EventHub.Domain/Events/EventTimeChangeLocalEventHandler.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.EventBus; - -namespace EventHub.Events -{ - public class EventTimeChangeLocalEventHandler : ILocalEventHandler, ITransientDependency - { - private readonly IRepository _eventRepository; - - public EventTimeChangeLocalEventHandler(IRepository eventRepository) - { - _eventRepository = eventRepository; - } - - public async Task HandleEventAsync(EventTimeChangingEventData eventData) - { - await UpdateEventForTimingChangeAsync(eventData.Event); - } - - private async Task UpdateEventForTimingChangeAsync(Event @event) - { - @event.IsTimingChangeEmailSent = false; - - await _eventRepository.UpdateAsync(@event, true); - } - } -} \ No newline at end of file diff --git a/src/EventHub.Domain/Events/EventTimeChangingEventData.cs b/src/EventHub.Domain/Events/EventTimeChangingEventData.cs deleted file mode 100644 index cf57a1a..0000000 --- a/src/EventHub.Domain/Events/EventTimeChangingEventData.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace EventHub.Events -{ - public class EventTimeChangingEventData - { - public Event Event { get; } - public DateTime OldStartTime { get; } - public DateTime OldEndTime { get; } - - public EventTimeChangingEventData(Event @event, DateTime oldStartTime, DateTime oldEndTime) - { - Event = @event; - OldStartTime = oldStartTime; - OldEndTime = oldEndTime; - } - } -} \ No newline at end of file diff --git a/src/EventHub.Domain/Events/Track.cs b/src/EventHub.Domain/Events/Track.cs index 908308f..96970ae 100644 --- a/src/EventHub.Domain/Events/Track.cs +++ b/src/EventHub.Domain/Events/Track.cs @@ -35,5 +35,32 @@ namespace EventHub.Events Name = Check.NotNullOrWhiteSpace(name, nameof(name), TrackConsts.MaxNameLength); return this; } + + internal Track AddSession( + Guid sessionId, + string title, + DateTime startTime, + DateTime endTime, + string description, + string language) + { + if (startTime > endTime) + { + throw new BusinessException(EventHubErrorCodes.EndTimeCantBeEarlierThanStartTime); + } + + foreach (var session in Sessions) + { + if (startTime.IsBetween(session.StartTime, session.EndTime) || + endTime.IsBetween(session.StartTime, session.EndTime)) + { + throw new BusinessException(EventHubErrorCodes.SessionTimeConflictsWithAnExistingSession); + } + } + + Sessions.Add(new Session(sessionId, Id, title, startTime, endTime, description)); + + return this; + } } } \ No newline at end of file diff --git a/test/EventHub.Domain.Tests/Events/EventTests.cs b/test/EventHub.Domain.Tests/Events/EventTests.cs index 18a23a4..1812363 100644 --- a/test/EventHub.Domain.Tests/Events/EventTests.cs +++ b/test/EventHub.Domain.Tests/Events/EventTests.cs @@ -23,7 +23,7 @@ namespace EventHub.Events ); }); - exception.Code.ShouldBe(EventHubErrorCodes.EventEndTimeCantBeEarlierThanStartTime); + exception.Code.ShouldBe(EventHubErrorCodes.EndTimeCantBeEarlierThanStartTime); } } } From 2b07713b738ad894b956ebc42191cc0c44bc16a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 22 Jul 2021 13:46:20 +0300 Subject: [PATCH 05/44] refactor --- src/EventHub.Domain.Shared/EventHubErrorCodes.cs | 2 +- src/EventHub.Domain/Events/EventManager.cs | 2 +- .../Events/Registrations/EventRegistrationManager.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs index 8268063..148225b 100644 --- a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs +++ b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs @@ -9,7 +9,7 @@ public const string CantRegisterOrUnregisterForAPastEvent = "EventHub:CantRegisterOrUnregisterForAPastEvent"; public const string NotAuthorizedToUpdateOrganizationProfile = "EventHub:NotAuthorizedToUpdateOrganizationProfile"; public const string CapacityOfEventFull = "EventHub:CapacityOfEventFull"; - public const string CapacityCantBeLowerThanRegisteredUserCount = "EventHub:CapacityCantBeLowerThanRegisteredUserCount"; + public const string CapacityCanNotBeLowerThanRegisteredUserCount = "EventHub:CapacityCantBeLowerThanRegisteredUserCount"; public const string NotAuthorizedToUpdateEvent = "EventHub:NotAuthorizedToUpdateEvent"; public const string CantChangeEventTiming = "EventHub:CantChangeEventTiming"; public const string SessionTimeShouldBeInTheEventTime = "EventHub:SessionTimeShouldBeInTheEventTime"; diff --git a/src/EventHub.Domain/Events/EventManager.cs b/src/EventHub.Domain/Events/EventManager.cs index 3f87ac5..69171b1 100644 --- a/src/EventHub.Domain/Events/EventManager.cs +++ b/src/EventHub.Domain/Events/EventManager.cs @@ -53,7 +53,7 @@ namespace EventHub.Events var registeredUserCount = await _eventRegistrationRepository.CountAsync(x => x.EventId == @event.Id); if (capacity.Value < registeredUserCount) { - throw new BusinessException(EventHubErrorCodes.CapacityCantBeLowerThanRegisteredUserCount); + throw new BusinessException(EventHubErrorCodes.CapacityCanNotBeLowerThanRegisteredUserCount); } } diff --git a/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs b/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs index 2938903..3d21a00 100644 --- a/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs +++ b/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs @@ -32,7 +32,7 @@ namespace EventHub.Events.Registrations var registrationCount = await _eventRegistrationRepository.CountAsync(x => x.EventId == @event.Id); - if (@event.Capacity != null && registrationCount >= @event.Capacity) + if (@event.Capacity != null && registrationCount >= @event.Capacity) { throw new BusinessException(EventHubErrorCodes.CapacityOfEventFull) .WithData("EventTitle", @event.Title); From b9dcf478969fa02c666f88c099c7d071d9d79dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 24 Jul 2021 12:54:41 +0300 Subject: [PATCH 06/44] Refactored EventRegistrationManager --- src/EventHub.Domain/Events/Event.cs | 1 + .../Events/Registrations/EventRegistrationManager.cs | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/EventHub.Domain/Events/Event.cs b/src/EventHub.Domain/Events/Event.cs index 9cc860c..eced286 100644 --- a/src/EventHub.Domain/Events/Event.cs +++ b/src/EventHub.Domain/Events/Event.cs @@ -47,6 +47,7 @@ namespace EventHub.Events public bool IsTimingChangeEmailSent { get; set; } public bool IsDraft { get; set; } + public ICollection Tracks { get; private set; } private Event() diff --git a/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs b/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs index 3d21a00..44e6c94 100644 --- a/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs +++ b/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs @@ -30,12 +30,14 @@ namespace EventHub.Events.Registrations return; } - var registrationCount = await _eventRegistrationRepository.CountAsync(x => x.EventId == @event.Id); - - if (@event.Capacity != null && registrationCount >= @event.Capacity) + if (@event.Capacity != null) { - throw new BusinessException(EventHubErrorCodes.CapacityOfEventFull) - .WithData("EventTitle", @event.Title); + var registrationCount = await _eventRegistrationRepository.CountAsync(x => x.EventId == @event.Id); + if (registrationCount >= @event.Capacity) + { + throw new BusinessException(EventHubErrorCodes.CapacityOfEventFull) + .WithData("EventTitle", @event.Title); + } } await _eventRegistrationRepository.InsertAsync( From 97309ed20a25c6882d204813ee30f3bf56970c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sun, 25 Jul 2021 12:32:40 +0300 Subject: [PATCH 07/44] Created migration for tracks and sessions --- ...ventHubDbContextModelCreatingExtensions.cs | 39 + ...3006_Added_Tracks_And_Sessions.Designer.cs | 2747 +++++++++++++++++ ...0210725093006_Added_Tracks_And_Sessions.cs | 115 + .../EventHubDbContextModelSnapshot.cs | 124 +- 4 files changed, 3024 insertions(+), 1 deletion(-) create mode 100644 src/EventHub.EntityFrameworkCore/Migrations/20210725093006_Added_Tracks_And_Sessions.Designer.cs create mode 100644 src/EventHub.EntityFrameworkCore/Migrations/20210725093006_Added_Tracks_And_Sessions.cs diff --git a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContextModelCreatingExtensions.cs b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContextModelCreatingExtensions.cs index 262d2bd..063941b 100644 --- a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContextModelCreatingExtensions.cs +++ b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContextModelCreatingExtensions.cs @@ -70,6 +70,45 @@ namespace EventHub.EntityFrameworkCore b.HasIndex(x => x.UrlCode); b.HasIndex(x => new {x.IsRemindingEmailSent, x.StartTime}); b.HasIndex(x => x.IsEmailSentToMembers); + + b.HasMany(x => x.Tracks).WithOne().IsRequired().HasForeignKey(x => x.EventId); + }); + + builder.Entity(b => + { + b.ToTable(EventHubConsts.DbTablePrefix + "EventTracks", EventHubConsts.DbSchema); + + b.ConfigureByConvention(); + + b.Property(x => x.Name).IsRequired().HasMaxLength(TrackConsts.MaxNameLength); + + b.HasMany(x => x.Sessions).WithOne().IsRequired().HasForeignKey(x => x.TrackId); + }); + + builder.Entity(b => + { + b.ToTable(EventHubConsts.DbTablePrefix + "EventSessions", EventHubConsts.DbSchema); + + b.ConfigureByConvention(); + + b.Property(x => x.Title).IsRequired().HasMaxLength(SessionConsts.MaxTitleLength); + b.Property(x => x.Description).IsRequired().HasMaxLength(SessionConsts.MaxDescriptionLength); + b.Property(x => x.Language).IsRequired().HasMaxLength(SessionConsts.MaxLanguageLength); + + b.HasMany(x => x.Speakers).WithOne().IsRequired().HasForeignKey(x => x.SessionId); + }); + + builder.Entity(b => + { + b.ToTable(EventHubConsts.DbTablePrefix + "EventSpeakers", EventHubConsts.DbSchema); + + b.ConfigureByConvention(); + + b.HasKey(x => new {x.SessionId, x.UserId}); + + b.HasOne().WithMany().HasForeignKey(x => x.UserId).IsRequired(); + + b.HasIndex(x => new {x.UserId, x.SessionId}); }); builder.Entity(b => diff --git a/src/EventHub.EntityFrameworkCore/Migrations/20210725093006_Added_Tracks_And_Sessions.Designer.cs b/src/EventHub.EntityFrameworkCore/Migrations/20210725093006_Added_Tracks_And_Sessions.Designer.cs new file mode 100644 index 0000000..63d3f93 --- /dev/null +++ b/src/EventHub.EntityFrameworkCore/Migrations/20210725093006_Added_Tracks_And_Sessions.Designer.cs @@ -0,0 +1,2747 @@ +// +using System; +using EventHub.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Volo.Abp.EntityFrameworkCore; + +namespace EventHub.Migrations +{ + [DbContext(typeof(EventHubDbContext))] + [Migration("20210725093006_Added_Tracks_And_Sessions")] + partial class Added_Tracks_And_Sessions + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql) + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.8") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("EventHub.Countries.Country", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("EhCountries"); + }); + + modelBuilder.Entity("EventHub.Events.Event", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Capacity") + .HasColumnType("integer"); + + b.Property("City") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CountryId") + .HasColumnType("uuid"); + + b.Property("CountryName") + .HasColumnType("text"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("EndTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsDraft") + .HasColumnType("boolean"); + + b.Property("IsEmailSentToMembers") + .HasColumnType("boolean"); + + b.Property("IsOnline") + .HasColumnType("boolean"); + + b.Property("IsRemindingEmailSent") + .HasColumnType("boolean"); + + b.Property("IsTimingChangeEmailSent") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("Language") + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("OnlineLink") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("StartTime") + .HasColumnType("timestamp without time zone"); + + b.Property("TimingChangeCount") + .HasColumnType("integer"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(69) + .HasColumnType("character varying(69)"); + + b.Property("UrlCode") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("character varying(8)"); + + b.HasKey("Id"); + + b.HasIndex("CountryId"); + + b.HasIndex("IsEmailSentToMembers"); + + b.HasIndex("StartTime"); + + b.HasIndex("UrlCode"); + + b.HasIndex("IsRemindingEmailSent", "StartTime"); + + b.HasIndex("OrganizationId", "StartTime"); + + b.ToTable("EhEvents"); + }); + + modelBuilder.Entity("EventHub.Events.Registrations.EventRegistration", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("EventId") + .HasColumnType("uuid"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("EventId", "UserId"); + + b.ToTable("EhEventRegistrations"); + }); + + modelBuilder.Entity("EventHub.Events.Session", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("EndTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Language") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("StartTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TrackId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TrackId"); + + b.ToTable("EhEventSessions"); + }); + + modelBuilder.Entity("EventHub.Events.Speaker", b => + { + b.Property("SessionId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("SessionId", "UserId"); + + b.HasIndex("UserId", "SessionId"); + + b.ToTable("EhEventSpeakers"); + }); + + modelBuilder.Entity("EventHub.Events.Track", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("EventId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("EventId"); + + b.ToTable("EhEventTracks"); + }); + + modelBuilder.Entity("EventHub.Organizations.Memberships.OrganizationMembership", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("OrganizationId", "UserId"); + + b.ToTable("EhOrganizationMemberships"); + }); + + modelBuilder.Entity("EventHub.Organizations.Organization", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("FacebookUsername") + .HasColumnType("text"); + + b.Property("GitHubUsername") + .HasColumnType("text"); + + b.Property("InstagramUsername") + .HasColumnType("text"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("MediumUsername") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("OwnerUserId") + .HasColumnType("uuid"); + + b.Property("TwitterUsername") + .HasColumnType("text"); + + b.Property("Website") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("DisplayName"); + + b.HasIndex("Name"); + + b.HasIndex("OwnerUserId"); + + b.ToTable("EhOrganizations"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("character varying(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasColumnType("text"); + + b.Property("ExecutionDuration") + .HasColumnType("integer") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("integer") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uuid") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uuid") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("text"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuditLogId") + .HasColumnType("uuid") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("integer") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuditLogId") + .HasColumnType("uuid") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("smallint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uuid"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("EntityChangeId") + .HasColumnType("uuid"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasMaxLength(1048576) + .HasColumnType("character varying(1048576)"); + + b.Property("JobName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("LastTryTime") + .HasColumnType("timestamp without time zone"); + + b.Property("NextTryTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uuid"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("bytea"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Required") + .HasColumnType("boolean"); + + b.Property("ValueType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("SourceTenantId") + .HasColumnType("uuid"); + + b.Property("SourceUserId") + .HasColumnType("uuid"); + + b.Property("TargetTenantId") + .HasColumnType("uuid"); + + b.Property("TargetUserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique(); + + b.ToTable("AbpLinkUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("boolean") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("boolean") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("boolean") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("character varying(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("character varying(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("character varying(96)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("SecurityStamp"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("character varying(196)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("character varying(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AllowedAccessTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiResources"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.Property("ApiResourceId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("ApiResourceId", "Type"); + + b.ToTable("IdentityServerApiResourceClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uuid"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("ApiResourceId", "Key", "Value"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => + { + b.Property("ApiResourceId") + .HasColumnType("uuid"); + + b.Property("Scope") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("ApiResourceId", "Scope"); + + b.ToTable("IdentityServerApiResourceScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => + { + b.Property("ApiResourceId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("Expiration") + .HasColumnType("timestamp without time zone"); + + b.HasKey("ApiResourceId", "Type", "Value"); + + b.ToTable("IdentityServerApiResourceSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Emphasize") + .HasColumnType("boolean"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Required") + .HasColumnType("boolean"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => + { + b.Property("ApiScopeId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("ApiScopeId", "Type"); + + b.ToTable("IdentityServerApiScopeClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => + { + b.Property("ApiScopeId") + .HasColumnType("uuid"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("ApiScopeId", "Key", "Value"); + + b.ToTable("IdentityServerApiScopeProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("integer"); + + b.Property("AccessTokenLifetime") + .HasColumnType("integer"); + + b.Property("AccessTokenType") + .HasColumnType("integer"); + + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("boolean"); + + b.Property("AllowOfflineAccess") + .HasColumnType("boolean"); + + b.Property("AllowPlainTextPkce") + .HasColumnType("boolean"); + + b.Property("AllowRememberConsent") + .HasColumnType("boolean"); + + b.Property("AllowedIdentityTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("boolean"); + + b.Property("AlwaysSendClientClaims") + .HasColumnType("boolean"); + + b.Property("AuthorizationCodeLifetime") + .HasColumnType("integer"); + + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("boolean"); + + b.Property("BackChannelLogoutUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("ClientClaimsPrefix") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ClientName") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ClientUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsentLifetime") + .HasColumnType("integer"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("DeviceCodeLifetime") + .HasColumnType("integer"); + + b.Property("EnableLocalLogin") + .HasColumnType("boolean"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("boolean"); + + b.Property("FrontChannelLogoutUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("IdentityTokenLifetime") + .HasColumnType("integer"); + + b.Property("IncludeJwtId") + .HasColumnType("boolean"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("LogoUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("PairWiseSubjectSalt") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ProtocolType") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("RefreshTokenExpiration") + .HasColumnType("integer"); + + b.Property("RefreshTokenUsage") + .HasColumnType("integer"); + + b.Property("RequireClientSecret") + .HasColumnType("boolean"); + + b.Property("RequireConsent") + .HasColumnType("boolean"); + + b.Property("RequirePkce") + .HasColumnType("boolean"); + + b.Property("RequireRequestObject") + .HasColumnType("boolean"); + + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("integer"); + + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("boolean"); + + b.Property("UserCodeType") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("UserSsoLifetime") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("IdentityServerClients"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Origin") + .HasMaxLength(150) + .HasColumnType("character varying(150)"); + + b.HasKey("ClientId", "Origin"); + + b.ToTable("IdentityServerClientCorsOrigins"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("GrantType") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.HasKey("ClientId", "GrantType"); + + b.ToTable("IdentityServerClientGrantTypes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Provider") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("ClientId", "Provider"); + + b.ToTable("IdentityServerClientIdPRestrictions"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("PostLogoutRedirectUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("ClientId", "PostLogoutRedirectUri"); + + b.ToTable("IdentityServerClientPostLogoutRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("ClientId", "Key", "Value"); + + b.ToTable("IdentityServerClientProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("RedirectUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("ClientId", "RedirectUri"); + + b.ToTable("IdentityServerClientRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Scope") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("ClientId", "Scope"); + + b.ToTable("IdentityServerClientScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("Expiration") + .HasColumnType("timestamp without time zone"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("character varying(50000)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("DeviceCode") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("SubjectId") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("UserCode") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode"); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => + { + b.Property("Key") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsumedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("character varying(50000)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Expiration") + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("SubjectId") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Key"); + + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); + + b.HasIndex("SubjectId", "SessionId", "Type"); + + b.ToTable("IdentityServerPersistedGrants"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Emphasize") + .HasColumnType("boolean"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Required") + .HasColumnType("boolean"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerIdentityResources"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("IdentityResourceId", "Type"); + + b.ToTable("IdentityServerIdentityResourceClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uuid"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("IdentityResourceId", "Key", "Value"); + + b.ToTable("IdentityServerIdentityResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("EventHub.Events.Event", b => + { + b.HasOne("EventHub.Countries.Country", null) + .WithMany() + .HasForeignKey("CountryId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("EventHub.Organizations.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Events.Registrations.EventRegistration", b => + { + b.HasOne("EventHub.Events.Event", null) + .WithMany() + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Events.Session", b => + { + b.HasOne("EventHub.Events.Track", null) + .WithMany("Sessions") + .HasForeignKey("TrackId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Events.Speaker", b => + { + b.HasOne("EventHub.Events.Session", null) + .WithMany("Speakers") + .HasForeignKey("SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Events.Track", b => + { + b.HasOne("EventHub.Events.Event", null) + .WithMany("Tracks") + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Organizations.Memberships.OrganizationMembership", b => + { + b.HasOne("EventHub.Organizations.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Organizations.Organization", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("OwnerUserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("OrganizationUnits") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany("Roles") + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Properties") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Scopes") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Secrets") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("UserClaims") + .HasForeignKey("ApiScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("Properties") + .HasForeignKey("ApiScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Claims") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedCorsOrigins") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedGrantTypes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("IdentityProviderRestrictions") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("PostLogoutRedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Properties") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("RedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedScopes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("ClientSecrets") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("UserClaims") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("Properties") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Events.Event", b => + { + b.Navigation("Tracks"); + }); + + modelBuilder.Entity("EventHub.Events.Session", b => + { + b.Navigation("Speakers"); + }); + + modelBuilder.Entity("EventHub.Events.Track", b => + { + b.Navigation("Sessions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/EventHub.EntityFrameworkCore/Migrations/20210725093006_Added_Tracks_And_Sessions.cs b/src/EventHub.EntityFrameworkCore/Migrations/20210725093006_Added_Tracks_And_Sessions.cs new file mode 100644 index 0000000..2935eef --- /dev/null +++ b/src/EventHub.EntityFrameworkCore/Migrations/20210725093006_Added_Tracks_And_Sessions.cs @@ -0,0 +1,115 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EventHub.Migrations +{ + public partial class Added_Tracks_And_Sessions : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsDraft", + table: "EhEvents", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateTable( + name: "EhEventTracks", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + EventId = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EhEventTracks", x => x.Id); + table.ForeignKey( + name: "FK_EhEventTracks_EhEvents_EventId", + column: x => x.EventId, + principalTable: "EhEvents", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "EhEventSessions", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + TrackId = table.Column(type: "uuid", nullable: false), + Title = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + StartTime = table.Column(type: "timestamp without time zone", nullable: false), + EndTime = table.Column(type: "timestamp without time zone", nullable: false), + Description = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: false), + Language = table.Column(type: "character varying(16)", maxLength: 16, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EhEventSessions", x => x.Id); + table.ForeignKey( + name: "FK_EhEventSessions_EhEventTracks_TrackId", + column: x => x.TrackId, + principalTable: "EhEventTracks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "EhEventSpeakers", + columns: table => new + { + SessionId = table.Column(type: "uuid", nullable: false), + UserId = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EhEventSpeakers", x => new { x.SessionId, x.UserId }); + table.ForeignKey( + name: "FK_EhEventSpeakers_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EhEventSpeakers_EhEventSessions_SessionId", + column: x => x.SessionId, + principalTable: "EhEventSessions", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_EhEventSessions_TrackId", + table: "EhEventSessions", + column: "TrackId"); + + migrationBuilder.CreateIndex( + name: "IX_EhEventSpeakers_UserId_SessionId", + table: "EhEventSpeakers", + columns: new[] { "UserId", "SessionId" }); + + migrationBuilder.CreateIndex( + name: "IX_EhEventTracks_EventId", + table: "EhEventTracks", + column: "EventId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "EhEventSpeakers"); + + migrationBuilder.DropTable( + name: "EhEventSessions"); + + migrationBuilder.DropTable( + name: "EhEventTracks"); + + migrationBuilder.DropColumn( + name: "IsDraft", + table: "EhEvents"); + } + } +} diff --git a/src/EventHub.EntityFrameworkCore/Migrations/EventHubDbContextModelSnapshot.cs b/src/EventHub.EntityFrameworkCore/Migrations/EventHubDbContextModelSnapshot.cs index c1e1de6..7feb89a 100644 --- a/src/EventHub.EntityFrameworkCore/Migrations/EventHubDbContextModelSnapshot.cs +++ b/src/EventHub.EntityFrameworkCore/Migrations/EventHubDbContextModelSnapshot.cs @@ -18,7 +18,7 @@ namespace EventHub.Migrations modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql) .HasAnnotation("Relational:MaxIdentifierLength", 63) - .HasAnnotation("ProductVersion", "5.0.7") + .HasAnnotation("ProductVersion", "5.0.8") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); modelBuilder.Entity("EventHub.Countries.Country", b => @@ -96,6 +96,9 @@ namespace EventHub.Migrations .HasDefaultValue(false) .HasColumnName("IsDeleted"); + b.Property("IsDraft") + .HasColumnType("boolean"); + b.Property("IsEmailSentToMembers") .HasColumnType("boolean"); @@ -205,6 +208,77 @@ namespace EventHub.Migrations b.ToTable("EhEventRegistrations"); }); + modelBuilder.Entity("EventHub.Events.Session", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("EndTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Language") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("StartTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TrackId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TrackId"); + + b.ToTable("EhEventSessions"); + }); + + modelBuilder.Entity("EventHub.Events.Speaker", b => + { + b.Property("SessionId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("SessionId", "UserId"); + + b.HasIndex("UserId", "SessionId"); + + b.ToTable("EhEventSpeakers"); + }); + + modelBuilder.Entity("EventHub.Events.Track", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("EventId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("EventId"); + + b.ToTable("EhEventTracks"); + }); + modelBuilder.Entity("EventHub.Organizations.Memberships.OrganizationMembership", b => { b.Property("Id") @@ -2236,6 +2310,39 @@ namespace EventHub.Migrations .IsRequired(); }); + modelBuilder.Entity("EventHub.Events.Session", b => + { + b.HasOne("EventHub.Events.Track", null) + .WithMany("Sessions") + .HasForeignKey("TrackId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Events.Speaker", b => + { + b.HasOne("EventHub.Events.Session", null) + .WithMany("Speakers") + .HasForeignKey("SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Events.Track", b => + { + b.HasOne("EventHub.Events.Event", null) + .WithMany("Tracks") + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("EventHub.Organizations.Memberships.OrganizationMembership", b => { b.HasOne("EventHub.Organizations.Organization", null) @@ -2537,6 +2644,21 @@ namespace EventHub.Migrations .IsRequired(); }); + modelBuilder.Entity("EventHub.Events.Event", b => + { + b.Navigation("Tracks"); + }); + + modelBuilder.Entity("EventHub.Events.Session", b => + { + b.Navigation("Speakers"); + }); + + modelBuilder.Entity("EventHub.Events.Track", b => + { + b.Navigation("Sessions"); + }); + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Navigation("Actions"); From a15e2f4c6645b5d9c894ad9b58b2758fa32423a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 2 Aug 2021 09:03:51 +0300 Subject: [PATCH 08/44] Update IEventAppService.cs --- .../Events/IEventAppService.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/EventHub.Application.Contracts/Events/IEventAppService.cs b/src/EventHub.Application.Contracts/Events/IEventAppService.cs index 047c1e5..f9a68fa 100644 --- a/src/EventHub.Application.Contracts/Events/IEventAppService.cs +++ b/src/EventHub.Application.Contracts/Events/IEventAppService.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.SettingManagement; namespace EventHub.Events { @@ -30,15 +32,16 @@ namespace EventHub.Events public class AddSessionDto { public Guid TrackId { get; set; } - + [Required] + [StringLength(SessionConsts.MaxTitleLength, + MinimumLength = SessionConsts.MinTitleLength)] public string Title { get; set; } - public DateTime StartTime { get; set; } - public DateTime EndTime { get; set; } - + [Required] + [StringLength(SessionConsts.MaxDescriptionLength, + MinimumLength = SessionConsts.MinDescriptionLength)] public string Description { get; set; } - public string Language { get; set; } } } From 165e67ebf555acfb88af26cde8e66489c0293e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 17 Aug 2021 11:02:50 +0300 Subject: [PATCH 09/44] Update EventController.cs --- .../Controllers/Events/EventController.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs b/src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs index b1f6e34..539e5ed 100644 --- a/src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs +++ b/src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs @@ -69,6 +69,13 @@ namespace EventHub.Controllers.Events await _eventAppService.UpdateAsync(id, input); } + [HttpPost] + [Route("{id}/sessions")] + public async Task AddSessionAsync(Guid id, AddSessionDto input) + { + await _eventAppService.AddSessionAsync(id, input); + } + [HttpGet] [Route("cover-image/{id}")] public async Task GetCoverImageAsync(Guid id) From b1cd80d6c71648dd68146fe3f082c081b91216c6 Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Wed, 1 Dec 2021 16:18:37 +0300 Subject: [PATCH 10/44] fix conflicts and errors --- .../Events/IEventAppService.cs | 3 +- .../Events/EventAppService.cs | 2 +- .../Events/EventConsts.cs | 58 ++++----- .../Events/SessionConsts.cs | 2 +- .../Events/TrackConsts.cs | 2 +- .../Localization/EventHub/en.json | 2 +- .../Web/EventHubUrlOptions.cs | 110 +++++++++--------- src/EventHub.Domain/Countries/Country.cs | 30 ++--- .../Registrations/EventRegistrationManager.cs | 1 + .../EventHub.EntityFrameworkCore.csproj | 4 +- .../Events/Event_Tests.cs | 4 +- 11 files changed, 109 insertions(+), 109 deletions(-) diff --git a/src/EventHub.Application.Contracts/Events/IEventAppService.cs b/src/EventHub.Application.Contracts/Events/IEventAppService.cs index f9a68fa..8296d9b 100644 --- a/src/EventHub.Application.Contracts/Events/IEventAppService.cs +++ b/src/EventHub.Application.Contracts/Events/IEventAppService.cs @@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.Content; using Volo.Abp.SettingManagement; namespace EventHub.Events @@ -26,7 +27,7 @@ namespace EventHub.Events Task AddSessionAsync(Guid id, AddSessionDto input); - Task GetCoverImageAsync(Guid id); + Task GetCoverImageAsync(Guid id); } public class AddSessionDto diff --git a/src/EventHub.Application/Events/EventAppService.cs b/src/EventHub.Application/Events/EventAppService.cs index 60be452..b70bd38 100644 --- a/src/EventHub.Application/Events/EventAppService.cs +++ b/src/EventHub.Application/Events/EventAppService.cs @@ -272,7 +272,7 @@ namespace EventHub.Events await _eventRepository.UpdateAsync(@event); } - public async Task GetCoverImageAsync(Guid id) + public async Task GetCoverImageAsync(Guid id) { var blobName = id.ToString(); diff --git a/src/EventHub.Domain.Shared/Events/EventConsts.cs b/src/EventHub.Domain.Shared/Events/EventConsts.cs index 6e27a39..ab6aba1 100644 --- a/src/EventHub.Domain.Shared/Events/EventConsts.cs +++ b/src/EventHub.Domain.Shared/Events/EventConsts.cs @@ -1,32 +1,32 @@ namespace EventHub.Events { - public static class EventConsts - { - public const string DefaultSorting = "Title desc"; - - public const int UrlCodeLength = 8; - public const int MaxTitleInUrlLength = 60; - public const int MaxUrlLength = MaxTitleInUrlLength + 1 + UrlCodeLength; //Format: {Title}-{UrlCode} - - public const int MinTitleLength = 8; - public const int MaxTitleLength = 128; - - public const int MinDescriptionLength = 50; - public const int MaxDescriptionLength = 2000; - - public const int MinOnlineLinkLength = 4; - public const int MaxOnlineLinkLength = 2000; - - public const int MinCityLength = 2; - public const int MaxCityLength = 32; - - public const int MinLanguageLength = 2; - public const int MaxLanguageLength = 16; - - public const int MaxTimingChangeCountForUser = 2; - - public const int MaxCoverImageFileSize = 5 * 1024 * 1024; - - public static string[] AllowedCoverImageExtensions = { ".jpg", ".png" }; - } + public static class EventConsts + { + public const string DefaultSorting = "Title desc"; + + public const int UrlCodeLength = 8; + public const int MaxTitleInUrlLength = 60; + public const int MaxUrlLength = MaxTitleInUrlLength + 1 + UrlCodeLength; //Format: {Title}-{UrlCode} + + public const int MinTitleLength = 8; + public const int MaxTitleLength = 128; + + public const int MinDescriptionLength = 50; + public const int MaxDescriptionLength = 2000; + + public const int MinOnlineLinkLength = 4; + public const int MaxOnlineLinkLength = 2000; + + public const int MinCityLength = 2; + public const int MaxCityLength = 32; + + public const int MinLanguageLength = 2; + public const int MaxLanguageLength = 16; + + public const int MaxTimingChangeCountForUser = 2; + + public const int MaxCoverImageFileSize = 5 * 1024 * 1024; + + public static string[] AllowedCoverImageExtensions = { ".jpg", ".png" }; + } } diff --git a/src/EventHub.Domain.Shared/Events/SessionConsts.cs b/src/EventHub.Domain.Shared/Events/SessionConsts.cs index 8f7e304..1ee8817 100644 --- a/src/EventHub.Domain.Shared/Events/SessionConsts.cs +++ b/src/EventHub.Domain.Shared/Events/SessionConsts.cs @@ -1,6 +1,6 @@ namespace EventHub.Events { - public class SessionConsts + public static class SessionConsts { public const int MinTitleLength = 8; public const int MaxTitleLength = 128; diff --git a/src/EventHub.Domain.Shared/Events/TrackConsts.cs b/src/EventHub.Domain.Shared/Events/TrackConsts.cs index 71b1de5..b3fb99d 100644 --- a/src/EventHub.Domain.Shared/Events/TrackConsts.cs +++ b/src/EventHub.Domain.Shared/Events/TrackConsts.cs @@ -1,6 +1,6 @@ namespace EventHub.Events { - public class TrackConsts + public static class TrackConsts { public const int MaxNameLength = 64; } diff --git a/src/EventHub.Domain.Shared/Localization/EventHub/en.json b/src/EventHub.Domain.Shared/Localization/EventHub/en.json index 3d05d69..557c460 100644 --- a/src/EventHub.Domain.Shared/Localization/EventHub/en.json +++ b/src/EventHub.Domain.Shared/Localization/EventHub/en.json @@ -83,7 +83,7 @@ "CoverImagePreview": "Cover Image Preview", "EventTimingChangeSuccessMessage": "The time of the event has been changed successfully!", "PastEvent": "Past Event", - "EventHub:SessionEndTimeCantBeEarlierThanStartTime": "Session end time can not be earlier than the start time." + "EventHub:SessionEndTimeCantBeEarlierThanStartTime": "Session end time can not be earlier than the start time.", "Menu:OrganizationManagement": "Organization Management", "Menu:OrganizationMemberships": "Memberships", "Permission:OrganizationManagement": "Organization Management", diff --git a/src/EventHub.Domain.Shared/Web/EventHubUrlOptions.cs b/src/EventHub.Domain.Shared/Web/EventHubUrlOptions.cs index 9446c4d..36f16d6 100644 --- a/src/EventHub.Domain.Shared/Web/EventHubUrlOptions.cs +++ b/src/EventHub.Domain.Shared/Web/EventHubUrlOptions.cs @@ -2,64 +2,64 @@ namespace EventHub.Web { - public class EventHubUrlOptions - { - private const string ConfigurationName = "AppUrls"; - private const string AccountDefaultValue = "https://localhost:44313"; - private const string AdminDefaultValue = "https://localhost:44307"; - private const string WwwDefaultValue = "https://localhost:44308"; - private const string ApiDefaultValue = "https://localhost:44362"; - private const string ApiInternalDefaultValue = ApiDefaultValue; - private const string AdminApiDefaultValue = "https://localhost:44305"; + public class EventHubUrlOptions + { + private const string ConfigurationName = "AppUrls"; + private const string AccountDefaultValue = "https://localhost:44313"; + private const string AdminDefaultValue = "https://localhost:44307"; + private const string WwwDefaultValue = "https://localhost:44308"; + private const string ApiDefaultValue = "https://localhost:44362"; + private const string ApiInternalDefaultValue = ApiDefaultValue; + private const string AdminApiDefaultValue = "https://localhost:44305"; - public string Account { get; set; } = AccountDefaultValue; - public string Www { get; set; } = WwwDefaultValue; - public string Api { get; set; } = ApiDefaultValue; - public string ApiInternal { get; set; } = ApiInternalDefaultValue; - public string Admin { get; set; } = AdminDefaultValue; - public string AdminApi { get; set; } = AdminApiDefaultValue; + public string Account { get; set; } = AccountDefaultValue; + public string Www { get; set; } = WwwDefaultValue; + public string Api { get; set; } = ApiDefaultValue; + public string ApiInternal { get; set; } = ApiInternalDefaultValue; + public string Admin { get; set; } = AdminDefaultValue; + public string AdminApi { get; set; } = AdminApiDefaultValue; - public static string GetAccountConfigValue(IConfiguration configuration) - { - return GetConfigValue(configuration, nameof(Account), AccountDefaultValue); - } - - public static string GetWwwConfigValue(IConfiguration configuration) - { - return GetConfigValue(configuration, nameof(Www), WwwDefaultValue); - } - - public static string GetApiInternalConfigValue(IConfiguration configuration) - { - return GetConfigValue(configuration, nameof(ApiInternal), ApiInternalDefaultValue); - } + public static string GetAccountConfigValue(IConfiguration configuration) + { + return GetConfigValue(configuration, nameof(Account), AccountDefaultValue); + } - public static string GetApiConfigValue(IConfiguration configuration) - { - return GetConfigValue(configuration, nameof(Api), ApiDefaultValue); - } - - public static string GetAdminConfigValue(IConfiguration configuration) - { - return GetConfigValue(configuration, nameof(Admin), AdminDefaultValue); - } + public static string GetWwwConfigValue(IConfiguration configuration) + { + return GetConfigValue(configuration, nameof(Www), WwwDefaultValue); + } - public static string GetAdminApiConfigValue(IConfiguration configuration) - { - return GetConfigValue(configuration, nameof(AdminApi), AdminApiDefaultValue); - } + public static string GetApiInternalConfigValue(IConfiguration configuration) + { + return GetConfigValue(configuration, nameof(ApiInternal), ApiInternalDefaultValue); + } - private static string GetConfigKey(string appName) - { - return $"{ConfigurationName}:{appName}"; - } - - private static string GetConfigValue( - IConfiguration configuration, - string appName, - string defaultValue) - { - return configuration[GetConfigKey(appName)] ?? defaultValue; - } - } + public static string GetApiConfigValue(IConfiguration configuration) + { + return GetConfigValue(configuration, nameof(Api), ApiDefaultValue); + } + + public static string GetAdminConfigValue(IConfiguration configuration) + { + return GetConfigValue(configuration, nameof(Admin), AdminDefaultValue); + } + + public static string GetAdminApiConfigValue(IConfiguration configuration) + { + return GetConfigValue(configuration, nameof(AdminApi), AdminApiDefaultValue); + } + + private static string GetConfigKey(string appName) + { + return $"{ConfigurationName}:{appName}"; + } + + private static string GetConfigValue( + IConfiguration configuration, + string appName, + string defaultValue) + { + return configuration[GetConfigKey(appName)] ?? defaultValue; + } + } } \ No newline at end of file diff --git a/src/EventHub.Domain/Countries/Country.cs b/src/EventHub.Domain/Countries/Country.cs index 1c05c25..1a00f36 100644 --- a/src/EventHub.Domain/Countries/Country.cs +++ b/src/EventHub.Domain/Countries/Country.cs @@ -4,21 +4,21 @@ using Volo.Abp.Domain.Entities; namespace EventHub.Countries { - public class Country : BasicAggregateRoot - { - public string Name { get; private set; } + public class Country : BasicAggregateRoot + { + public string Name { get; private set; } - private Country() - { - - } + private Country() + { - internal Country( - Guid id, - string name) - : base(id) - { - Name = Check.NotNullOrWhiteSpace(name, nameof(name), CountryConsts.MaxNameLength); - } - } + } + + internal Country( + Guid id, + string name) + : base(id) + { + Name = Check.NotNullOrWhiteSpace(name, nameof(name), CountryConsts.MaxNameLength); + } + } } \ No newline at end of file diff --git a/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs b/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs index 58bb782..4f46edb 100644 --- a/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs +++ b/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using Volo.Abp; +using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Services; using Volo.Abp.Guids; using Volo.Abp.Identity; diff --git a/src/EventHub.EntityFrameworkCore/EventHub.EntityFrameworkCore.csproj b/src/EventHub.EntityFrameworkCore/EventHub.EntityFrameworkCore.csproj index 1e10f87..3c6f376 100644 --- a/src/EventHub.EntityFrameworkCore/EventHub.EntityFrameworkCore.csproj +++ b/src/EventHub.EntityFrameworkCore/EventHub.EntityFrameworkCore.csproj @@ -19,8 +19,8 @@ - - + + diff --git a/test/EventHub.Domain.Tests/Events/Event_Tests.cs b/test/EventHub.Domain.Tests/Events/Event_Tests.cs index 6a49efd..e295449 100644 --- a/test/EventHub.Domain.Tests/Events/Event_Tests.cs +++ b/test/EventHub.Domain.Tests/Events/Event_Tests.cs @@ -44,8 +44,6 @@ namespace EventHub.Events //ASSERT evnt.StartTime.ShouldBe(newStartTime); evnt.EndTime.ShouldBe(newEndTime); - evnt.GetLocalEvents() - .ShouldContain(x => x.EventData is EventTimeChangingEventData); } [Fact] @@ -65,7 +63,7 @@ namespace EventHub.Events }); exception.Code.ShouldBe( - EventHubErrorCodes.EventEndTimeCantBeEarlierThanStartTime); + EventHubErrorCodes.EndTimeCantBeEarlierThanStartTime); } } } From c1a2cb73e4c0c2bd01e73a40ace2443f4416d424 Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Thu, 2 Dec 2021 15:35:28 +0300 Subject: [PATCH 11/44] Implementation of payment design --- .../Pages/Payment/PostCheckout.cshtml.cs | 26 +- .../Pages/Payment/PreCheckout.cshtml.cs | 24 +- src/EventHub.Web/EventHubWebModule.cs | 34 +-- src/EventHub.Web/Pages/Empty.cshtml | 2 +- ..._upgradeOrExtendOrganizationSection.cshtml | 56 +++++ .../Pages/Organizations/Profile.cshtml | 43 +--- .../Pages/Organizations/Profile.js | 29 ++- .../Payment/CustomPostCheckout.cshtml.cs | 77 ++++++ .../Pages/Payment/PostCheckout.cshtml | 23 +- .../Pages/Payment/PreCheckout.cshtml | 115 +++------ src/EventHub.Web/Pages/Pricing.cshtml | 231 ++++++++---------- src/EventHub.Web/wwwroot/assets/success.svg | 1 + 12 files changed, 357 insertions(+), 304 deletions(-) create mode 100644 src/EventHub.Web/Pages/Organizations/Components/_upgradeOrExtendOrganizationSection.cshtml create mode 100644 src/EventHub.Web/Pages/Payment/CustomPostCheckout.cshtml.cs create mode 100644 src/EventHub.Web/wwwroot/assets/success.svg diff --git a/modules/payment/src/Payment.Web/Pages/Payment/PostCheckout.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/PostCheckout.cshtml.cs index 26e5c54..377b247 100644 --- a/modules/payment/src/Payment.Web/Pages/Payment/PostCheckout.cshtml.cs +++ b/modules/payment/src/Payment.Web/Pages/Payment/PostCheckout.cshtml.cs @@ -16,42 +16,42 @@ namespace Payment.Web.Pages.Payment public string GoBackLink { get; set; } - private readonly IPaymentRequestAppService _paymentRequestAppService; - private readonly PaymentWebOptions _paymentWebOptions; - private readonly IPaymentUrlBuilder _paymentUrlBuilder; + protected IPaymentRequestAppService PaymentRequestAppService { get; } + protected PaymentWebOptions PaymentWebOptions { get; } + protected IPaymentUrlBuilder PaymentUrlBuilder { get; } public PostCheckoutPageModel( IPaymentRequestAppService appService, IOptions paymentWebOptions, IPaymentUrlBuilder paymentUrlBuilder) { - _paymentRequestAppService = appService; - _paymentWebOptions = paymentWebOptions.Value; - _paymentUrlBuilder = paymentUrlBuilder; + PaymentRequestAppService = appService; + PaymentWebOptions = paymentWebOptions.Value; + PaymentUrlBuilder = paymentUrlBuilder; } - public async Task OnGetAsync() + public virtual async Task OnGetAsync() { if (Token.IsNullOrWhiteSpace()) { return BadRequest(); } - PaymentRequest = await _paymentRequestAppService.CompleteAsync(Token); + PaymentRequest = await PaymentRequestAppService.CompleteAsync(Token); - GoBackLink = _paymentUrlBuilder.BuildCheckoutUrl(PaymentRequest.Id).AbsoluteUri; + GoBackLink = PaymentUrlBuilder.BuildCheckoutUrl(PaymentRequest.Id).AbsoluteUri; if (PaymentRequest.State == PaymentRequestState.Completed - && !_paymentWebOptions.PaymentSuccessfulCallbackUrl.IsNullOrWhiteSpace()) + && !PaymentWebOptions.PaymentSuccessfulCallbackUrl.IsNullOrWhiteSpace()) { - var callbackUrl = _paymentWebOptions.PaymentSuccessfulCallbackUrl + "?paymentRequestId=" + PaymentRequest.Id; + var callbackUrl = PaymentWebOptions.PaymentSuccessfulCallbackUrl + "?paymentRequestId=" + PaymentRequest.Id; Response.Redirect(callbackUrl); } if (PaymentRequest.State == PaymentRequestState.Failed - && !_paymentWebOptions.PaymentFailureCallbackUrl.IsNullOrWhiteSpace()) + && !PaymentWebOptions.PaymentFailureCallbackUrl.IsNullOrWhiteSpace()) { - var callbackUrl = _paymentWebOptions.PaymentFailureCallbackUrl + "?paymentRequestId=" + PaymentRequest.Id; + var callbackUrl = PaymentWebOptions.PaymentFailureCallbackUrl + "?paymentRequestId=" + PaymentRequest.Id; Response.Redirect(callbackUrl); } diff --git a/modules/payment/src/Payment.Web/Pages/Payment/PreCheckout.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/PreCheckout.cshtml.cs index 0902d77..3e8f2f2 100644 --- a/modules/payment/src/Payment.Web/Pages/Payment/PreCheckout.cshtml.cs +++ b/modules/payment/src/Payment.Web/Pages/Payment/PreCheckout.cshtml.cs @@ -14,36 +14,36 @@ namespace Payment.Web.Pages.Payment public PaymentRequestDto PaymentRequest { get; set; } - private readonly IPaymentRequestAppService _paymentRequestAppService; - private readonly IPaymentUrlBuilder _paymentUrlBuilder; + protected IPaymentRequestAppService PaymentRequestAppService { get; } + protected IPaymentUrlBuilder PaymentUrlBuilder { get; } public PreCheckoutPageModel( IPaymentRequestAppService paymentRequestAppService, IPaymentUrlBuilder paymentUrlBuilder) { - _paymentRequestAppService = paymentRequestAppService; - _paymentUrlBuilder = paymentUrlBuilder; + PaymentRequestAppService = paymentRequestAppService; + PaymentUrlBuilder = paymentUrlBuilder; } - public async Task OnGetAsync() + public virtual async Task OnGetAsync() { - PaymentRequest = await _paymentRequestAppService.GetAsync(PaymentRequestId); + PaymentRequest = await PaymentRequestAppService.GetAsync(PaymentRequestId); return Page(); } - public async Task OnPostAsync() + public virtual async Task OnPostAsync() { - PaymentRequest = await _paymentRequestAppService.GetAsync(PaymentRequestId); + PaymentRequest = await PaymentRequestAppService.GetAsync(PaymentRequestId); - var result = await _paymentRequestAppService.StartPaymentAsync(new StartPaymentDto + var result = await PaymentRequestAppService.StartPaymentAsync(new StartPaymentDto { PaymentRequestId = PaymentRequest.Id, - ReturnUrl = _paymentUrlBuilder.BuildReturnUrl(PaymentRequestId).AbsoluteUri, - CancelUrl = _paymentUrlBuilder.BuildCheckoutUrl(PaymentRequestId).AbsoluteUri + ReturnUrl = PaymentUrlBuilder.BuildReturnUrl(PaymentRequestId).AbsoluteUri, + CancelUrl = PaymentUrlBuilder.BuildCheckoutUrl(PaymentRequestId).AbsoluteUri }); Response.Redirect(result.CheckoutLink); } } -} \ No newline at end of file +} diff --git a/src/EventHub.Web/EventHubWebModule.cs b/src/EventHub.Web/EventHubWebModule.cs index 05f9382..2202976 100644 --- a/src/EventHub.Web/EventHubWebModule.cs +++ b/src/EventHub.Web/EventHubWebModule.cs @@ -89,23 +89,7 @@ namespace EventHub.Web ConfigureRazorPageOptions(); ConfigurePremiumPlanInfo(context, configuration); } - - private void ConfigurePremiumPlanInfo(ServiceConfigurationContext context, IConfiguration configuration) - { - context.Services.AddOptions() - .Bind(configuration.GetSection(PremiumPlanInfoOptions.OrganizationPlanInfo)) - .ValidateDataAnnotations() - .Validate(config => - { - if (config.IsActive) - { - return config.OnePremiumPeriodAsMonth > config.CanBeExtendedAfterHowManyMonths; - } - - return true; - }, "OnePremiumPeriodAsMonth must be greater than CanBeExtendedAfterHowManyMonths."); - } - + private void ConfigureBundles() { Configure(options => @@ -250,6 +234,22 @@ namespace EventHub.Web .PersistKeysToStackExchangeRedis(redis, "EventHub-Protection-Keys"); } + private void ConfigurePremiumPlanInfo(ServiceConfigurationContext context, IConfiguration configuration) + { + context.Services.AddOptions() + .Bind(configuration.GetSection(PremiumPlanInfoOptions.OrganizationPlanInfo)) + .ValidateDataAnnotations() + .Validate(config => + { + if (config.IsActive) + { + return config.OnePremiumPeriodAsMonth > config.CanBeExtendedAfterHowManyMonths; + } + + return true; + }, "OnePremiumPeriodAsMonth must be greater than CanBeExtendedAfterHowManyMonths."); + } + public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); diff --git a/src/EventHub.Web/Pages/Empty.cshtml b/src/EventHub.Web/Pages/Empty.cshtml index 5db1274..491dd0e 100644 --- a/src/EventHub.Web/Pages/Empty.cshtml +++ b/src/EventHub.Web/Pages/Empty.cshtml @@ -1,7 +1,7 @@ @page "/test" @using EventHub.Web.Pages @model EventHub.Web.Pages.Empty - + @* TODO(berkansasmaz): Delete this page *@

Create an Event

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ut nulla consequat, tempus sapien in, diff --git a/src/EventHub.Web/Pages/Organizations/Components/_upgradeOrExtendOrganizationSection.cshtml b/src/EventHub.Web/Pages/Organizations/Components/_upgradeOrExtendOrganizationSection.cshtml new file mode 100644 index 0000000..e21c089 --- /dev/null +++ b/src/EventHub.Web/Pages/Organizations/Components/_upgradeOrExtendOrganizationSection.cshtml @@ -0,0 +1,56 @@ +@using EventHub.Web.PaymentRequests +@using Microsoft.Extensions.Options +@model EventHub.Organizations.OrganizationProfileDto +@inject IOptionsSnapshot PremiumPlanInfoOptionsSnapshot + + + + @if (Model.IsPremium && PremiumPlanInfoOptionsSnapshot.Value.IsActive && PremiumPlanInfoOptionsSnapshot.Value.IsExtendable && Model.PremiumEndDate!.Value.IsBetween(DateTime.Now, DateTime.Now.AddMonths(PremiumPlanInfoOptionsSnapshot.Value.OnePremiumPeriodAsMonth - PremiumPlanInfoOptionsSnapshot.Value.CanBeExtendedAfterHowManyMonths))) + { + Premium end date: @Model.PremiumEndDate!.Value.ToShortDateString() + } + + Edit + + + @if (PremiumPlanInfoOptionsSnapshot.Value.IsActive) + { + @if (Model.IsPremium) + { + @if (PremiumPlanInfoOptionsSnapshot.Value.IsExtendable && Model.PremiumEndDate!.Value.IsBetween(DateTime.Now, DateTime.Now.AddMonths(PremiumPlanInfoOptionsSnapshot.Value.OnePremiumPeriodAsMonth - PremiumPlanInfoOptionsSnapshot.Value.CanBeExtendedAfterHowManyMonths))) + { +

+ } + else + { +
+ +
+ } + } + else + { + + } + } + else + { + + + Premium end date: @Model.PremiumEndDate!.Value.ToShortDateString() + + + } + + + diff --git a/src/EventHub.Web/Pages/Organizations/Profile.cshtml b/src/EventHub.Web/Pages/Organizations/Profile.cshtml index f6b13f8..b31a97c 100644 --- a/src/EventHub.Web/Pages/Organizations/Profile.cshtml +++ b/src/EventHub.Web/Pages/Organizations/Profile.cshtml @@ -8,6 +8,7 @@ @using EventHub.Web.PaymentRequests @using Microsoft.AspNetCore.Mvc.Localization @using Microsoft.Extensions.Options +@using Volo.Abp.AspNetCore.Mvc.UI.Packages.SweetAlert2 @using Volo.Abp.Timing @model EventHub.Web.Pages.Organizations.ProfilePageModel @inject IClock Clock @@ -15,6 +16,7 @@ @inject IOptionsSnapshot PremiumPlanInfoOptionsSnapshot @section scripts { + } @@ -66,44 +68,7 @@ @if (Model.IsOrganizationOwner) { - - Edit - - - @if (PremiumPlanInfoOptionsSnapshot.Value.IsActive) - { - - - @if (Model.Organization.IsPremium) - { - Premium end date: @Model.Organization.PremiumEndDate!.Value.ToShortDateString() - @if (PremiumPlanInfoOptionsSnapshot.Value.IsExtendable && Model.Organization.PremiumEndDate!.Value.IsBetween(DateTime.Now, DateTime.Now.AddMonths(PremiumPlanInfoOptionsSnapshot.Value.OnePremiumPeriodAsMonth - PremiumPlanInfoOptionsSnapshot.Value.CanBeExtendedAfterHowManyMonths))) - { - - } - } - else - { - - } - - - }else if (Model.Organization.IsPremium) - { - - - Premium end date: @Model.Organization.PremiumEndDate!.Value.ToShortDateString() - - - } + } @await Component.InvokeAsync(typeof(JoinAreaViewComponent), new {organizationId = Model.Organization.Id}) @await Component.InvokeAsync(typeof(MembersAreaViewComponent), @@ -212,4 +177,4 @@ - \ No newline at end of file + diff --git a/src/EventHub.Web/Pages/Organizations/Profile.js b/src/EventHub.Web/Pages/Organizations/Profile.js index d289691..010a2e1 100644 --- a/src/EventHub.Web/Pages/Organizations/Profile.js +++ b/src/EventHub.Web/Pages/Organizations/Profile.js @@ -1,13 +1,36 @@ $(function () { $('.events > .nav-item > a[data-toggle="tab"]').on('shown.bs.tab', function (e) { var target = $(e.target).attr("href") - if (target === "#UpcomingEvent"){ + if (target === "#UpcomingEvent") { $("a[href='#PastEvent']").removeClass('selected'); $("a[href='#UpcomingEvent']").addClass('selected'); - }else{ + } else { $("a[href='#UpcomingEvent']").removeClass('selected'); $("a[href='#PastEvent']").addClass('selected'); } }); -}); \ No newline at end of file + + var searchParams = new URLSearchParams(window.location.search); + var paymentRequestId = searchParams.get('paymentRequestId'); + if (paymentRequestId.length === 36) { + payment.paymentRequests.paymentRequest + .get(paymentRequestId) + .then(function (r) { + if (r.extraProperties.Status === "COMPLETED") { + Swal.fire({ + title: 'Thank you for your purchase!', + text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam utnulla consequat.', + imageUrl: '/assets/success.svg', + imageHeight: "70", + imageWidth: "70", + showCloseButton: true, + confirmButtonText: 'Close' + }).then(() => { + window.location.replace(window.location.pathname) + }); + } + }); + } + +}); diff --git a/src/EventHub.Web/Pages/Payment/CustomPostCheckout.cshtml.cs b/src/EventHub.Web/Pages/Payment/CustomPostCheckout.cshtml.cs new file mode 100644 index 0000000..dac8f18 --- /dev/null +++ b/src/EventHub.Web/Pages/Payment/CustomPostCheckout.cshtml.cs @@ -0,0 +1,77 @@ +using System; +using System.Threading.Tasks; +using EventHub.Organizations; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Options; +using Newtonsoft.Json; +using Payment.PaymentRequests; +using Payment.Web; +using Payment.Web.Pages.Payment; +using Payment.Web.PaymentRequest; + +namespace EventHub.Web.Pages.Payment; + +public class CustomPostCheckoutPageModel : PostCheckoutPageModel +{ + public string OrganizationName { get; set; } + + public CustomPostCheckoutPageModel( + IPaymentRequestAppService appService, + IOptions paymentWebOptions, + IPaymentUrlBuilder paymentUrlBuilder) + : base( + appService, + paymentWebOptions, + paymentUrlBuilder) + { + } + + public override async Task OnGetAsync() + { + if (Token.IsNullOrWhiteSpace()) + { + return BadRequest(); + } + + PaymentRequest = await PaymentRequestAppService.CompleteAsync(Token); + + FillOrganizationName(); + PaymentWebOptions.PaymentSuccessfulCallbackUrl = Url.Page("/Organizations/Profile", new { name = OrganizationName }); + + GoBackLink = PaymentUrlBuilder.BuildCheckoutUrl(PaymentRequest.Id).AbsoluteUri; + + if (PaymentRequest.State == PaymentRequestState.Completed + && !PaymentWebOptions.PaymentSuccessfulCallbackUrl.IsNullOrWhiteSpace()) + { + var callbackUrl = PaymentWebOptions.PaymentSuccessfulCallbackUrl + "?paymentRequestId=" + PaymentRequest.Id; + Response.Redirect(callbackUrl); + } + + if (PaymentRequest.State == PaymentRequestState.Failed + && !PaymentWebOptions.PaymentFailureCallbackUrl.IsNullOrWhiteSpace()) + { + var callbackUrl = PaymentWebOptions.PaymentFailureCallbackUrl + "?paymentRequestId=" + PaymentRequest.Id; + Response.Redirect(callbackUrl); + } + + return Page(); + } + + private void FillOrganizationName() + { + var isExistExtraProperties = PaymentRequest.ExtraProperties.TryGetValue(nameof(OrganizationPaymentRequestExtraParameterConfiguration), out var ExtraProperties); + if (!isExistExtraProperties) + { + throw new BadHttpRequestException(""); + } + + var organizationPaymentExtraParameterConfiguration = JsonConvert.DeserializeObject(ExtraProperties.ToString()); + if (organizationPaymentExtraParameterConfiguration is null) + { + throw new BadHttpRequestException(""); + } + + OrganizationName = organizationPaymentExtraParameterConfiguration.OrganizationName; + } +} diff --git a/src/EventHub.Web/Pages/Payment/PostCheckout.cshtml b/src/EventHub.Web/Pages/Payment/PostCheckout.cshtml index 64849f0..4d7047b 100644 --- a/src/EventHub.Web/Pages/Payment/PostCheckout.cshtml +++ b/src/EventHub.Web/Pages/Payment/PostCheckout.cshtml @@ -1,32 +1,15 @@ @page -@using EventHub.Organizations @using EventHub.Web -@using Microsoft.AspNetCore.Http @using Microsoft.Extensions.Options -@using Newtonsoft.Json -@using Payment.Web.Pages.Payment @using Payment.PaymentRequests @using Volo.Abp.Users @inherits Payment.Web.Pages.PaymentPageBase -@model Payment.Web.Pages.Payment.PostCheckoutPageModel +@model EventHub.Web.Pages.Payment.CustomPostCheckoutPageModel @inject IOptions UrlOptions @inject ICurrentUser CurrentUser @{ PageLayout.Content.Title = L["PaymentResult"] + L["Enum:PaymentRequestState:" + Model.PaymentRequest.State]; - - var isExistExtraProperties = Model.PaymentRequest.ExtraProperties.TryGetValue(nameof(OrganizationPaymentRequestExtraParameterConfiguration), out var ExtraProperties); - if (!isExistExtraProperties) - { - throw new BadHttpRequestException(""); - } - - var organizationPaymentExtraParameterConfiguration = JsonConvert.DeserializeObject(ExtraProperties.ToString()); - if (organizationPaymentExtraParameterConfiguration is null) - { - throw new BadHttpRequestException(""); - } - var organizationName = organizationPaymentExtraParameterConfiguration.OrganizationName; }
@@ -69,8 +52,8 @@ -
\ No newline at end of file +
diff --git a/src/EventHub.Web/Pages/Payment/PreCheckout.cshtml b/src/EventHub.Web/Pages/Payment/PreCheckout.cshtml index 4a68285..3fb9203 100644 --- a/src/EventHub.Web/Pages/Payment/PreCheckout.cshtml +++ b/src/EventHub.Web/Pages/Payment/PreCheckout.cshtml @@ -31,79 +31,42 @@ } - -
- -
Shopping Cart
- - -
- - - - - - - - - - - - - - -
Product Name & DetailsTotal
-
-
-

@Model.PaymentRequest.ProductName

- - @if (!organizationPaymentRequestExtraParameterConfiguration.IsExtend) - { - Target Plan: @OrganizationPlanType.Premium - End date: @DateTime.Now.AddMonths(planInfo.OnePremiumPeriodAsMonth).ToShortDateString() - } - else - { - Plan: @OrganizationPlanType.Premium - } -   - -
-
-
@Model.PaymentRequest.Price @Model.PaymentRequest.Currency
-
- -
- - - -
- -
@Model.PaymentRequest.Price @Model.PaymentRequest.Currency
-
-
-
-
-
- - - - -
- @if (Model.PaymentRequest.State != PaymentRequestState.Waiting) - { - Current State: @Model.PaymentRequest.State - @L["PaymentRequestIsNotWaiting"] - } - else - { - @L["Checkout"] - Back to pricing - } -
-
-
-
-
-
-
\ No newline at end of file +
+

Shopping Cart

+
+
+
+
+

Product Detail

+

@OrganizationPlanType.Premium Account: @organizationName.ToUpperInvariant()

+ @if (!organizationPaymentRequestExtraParameterConfiguration.IsExtend) + { +

Start Date: @DateTime.Now.ToShortDateString()

+

End Date: @DateTime.Now.AddMonths(planInfo.OnePremiumPeriodAsMonth).ToShortDateString()

+ } + else + { +

Your license will be extended for @planInfo.OnePremiumPeriodAsMonth months.

+ } +
+
+
+
+
+
+

Summary

+
+

Premium Licence @Model.PaymentRequest.Price @Model.PaymentRequest.Currency

+
+

TOTAL @Model.PaymentRequest.Price @Model.PaymentRequest.Currency

+
+
+
+ +
+
+
+
+
+
+
diff --git a/src/EventHub.Web/Pages/Pricing.cshtml b/src/EventHub.Web/Pages/Pricing.cshtml index f96572d..02da933 100644 --- a/src/EventHub.Web/Pages/Pricing.cshtml +++ b/src/EventHub.Web/Pages/Pricing.cshtml @@ -8,129 +8,114 @@ } -
-
- -

- Pricing plans -

-
- Choose the plan best for your organization. -
- -
- -
-
-
Free account
-
-
- $ - 0 -
-
-

1 event per month

-

300 attendees per event

-
+
+

Eventhub Pricing List

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ut nulla consequat, tempus sapien in, + pellentesque nunc. Sed at nunc pellentesque, fermentum mi et, fermentum massa.

+
+
+
+
+

Normal Account

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam utnulla consequat, tempus sapien in.

+
+ $ + 0 +
+
    +
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • +
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • +
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • +
+
+
-
+ @if (Model.PremiumPlanInfo is not null) + { +
+
+
+

Premium Account

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam utnulla consequat, tempus sapien in.

+
+ $ + @Model.PremiumPlanInfo.Price +
+
    +
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • +
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • +
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit adipiscing elit.
  • +
  • Lorem ipsum adipiscing elit dolor sit amet, consectetur adipiscing elit.
  • +
  • Lorem adipiscing elit adipiscing elitipsum dolor sit amet, consectetur adipiscing elit.
  • +
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • +
+ @if (Model.Organization.IsPremium) + { +
+ + + Extend Now +
+ } + else + { +
+ + + Upgrade to @Model.PremiumPlanInfo.PlanType +
+ } +
+
+
+ } +

Frequently Asked Questions

+ +
+
+
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit. +

+
+
+
+
+
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit. +

+
+
+
+
+
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. +

+
+
+
+
+
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit. +

+
+
+
-
- - @if(Model.PremiumPlanInfo is not null) - { -
-
-
- @Model.PremiumPlanInfo.PlanType account - @if (Model.Organization.IsPremium) - { - Current Plan - } -
-
-
- $ - @Model.PremiumPlanInfo.Price -
-
-

unlimited events

-

unlimited attendees

-
-
-
- - @if (Model.Organization.IsPremium) - { -
- - - Extend Now -
- } - else - { -
- - - Upgrade To @Model.PremiumPlanInfo.PlanType -
- } -
-
- } -
- @* -

Frequently Asked Questions

- -
-
- -
Dapibus ac facilisis in?
-

- Lorem ipsum dolor sit amet, ius virtute suscipit te. Ius prima euismod consequat eu. -

- -
Cras justo odio?
-

- Etiam vivendo eu sea, purto ponderum mediocritatem at pro. -

- -
Porta ac consectetur ac?
-

- Iuvaret deleniti vulputate nec ne, id vix lucilius legendos deseruisse. -

- -
Ne ornatus albucius ius?
-

- Lorem ipsum dolor sit amet, mea in pertinax hendrerit gloriatur. -

- -
-
- -
Ne ornatus albucius ius?
-

- Lorem ipsum dolor sit amet, mea in pertinax hendrerit gloriatur. -

- -
Quo insolens intellegam dissentiet at?
-

- Ex fugit legimus fuisset per. Ex quidam option diceret ius. -

- -
Ad his assum delenit blandit?
-

- Ne ornatus albucius ius, nostrum dignissim repudiandae an usu. -

- -
Dapibus ac facilisis in?
-

- Lorem ipsum dolor sit amet, ius virtute suscipit te. Ius prima euismod consequat eu. -

- -
- *@ -
-
\ No newline at end of file + diff --git a/src/EventHub.Web/wwwroot/assets/success.svg b/src/EventHub.Web/wwwroot/assets/success.svg new file mode 100644 index 0000000..987540e --- /dev/null +++ b/src/EventHub.Web/wwwroot/assets/success.svg @@ -0,0 +1 @@ + \ No newline at end of file From 0c513122ac23e6a20199ff4bc808010ea33301bc Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Thu, 9 Dec 2021 18:25:11 +0300 Subject: [PATCH 12/44] Add track feature --- .../Events/AddSessionDto.cs | 23 ++ .../Events/AddTractDto.cs | 10 + .../Events/EventDetailDto.cs | 9 + .../Events/EventInListDto.cs | 7 +- .../Events/IEventAppService.cs | 24 +- .../Events/TrackDto.cs | 9 + .../Events/UpdateEventDto.cs | 4 +- .../EventHubApplicationAutoMapperProfile.cs | 3 + .../Events/EventAppService.cs | 109 ++++++--- .../EventHubErrorCodes.cs | 1 + .../Localization/EventHub/en.json | 3 +- src/EventHub.Domain/Events/Event.cs | 22 +- src/EventHub.Domain/Events/Track.cs | 4 +- .../Events/EventRepository.cs | 5 + .../EventHubHttpApiClientModule.cs | 6 + .../Controllers/Events/EventController.cs | 104 --------- .../EventHubHttpApiHostModule.cs | 1 - .../Controllers/EventHubController.cs | 6 +- .../Controllers/Events/EventController.cs | 124 +++++++++++ .../EventRegistrationController.cs | 4 +- .../OrganizationMembershipController.cs | 4 +- .../Organizations/OrganizationController.cs | 6 +- .../Controllers/Users/UserController.cs | 6 +- .../Controllers/EventController.cs | 17 +- .../EventRegistrationController.cs | 10 - .../OrganizationMembershipController.cs | 12 +- .../Controllers/WidgetsController.cs | 30 +++ .../EventHubWebAutoMapperProfile.cs | 4 +- .../CreateEventAreaViewComponent.cs | 175 +++++++++++++++ .../Components/CreateEventArea/Default.cshtml | 21 ++ .../CreateEventArea/_addTrackSection.cshtml | 71 ++++++ .../CreateEventArea/_newEventSection.cshtml | 143 ++++++++++++ .../CreateEventArea/_progressSection.cshtml | 15 ++ .../CreateEventArea/create-event-area.js | 69 ++++++ .../RegistrationAreaViewComponent.cs | 2 +- src/EventHub.Web/Pages/Events/New.cshtml | 207 +++++++----------- src/EventHub.Web/Pages/Events/New.cshtml.cs | 164 ++------------ .../JoinArea/JoinAreaViewComponent.cs | 4 +- src/EventHub.Web/Pages/Pricing.cshtml | 2 +- 39 files changed, 967 insertions(+), 473 deletions(-) create mode 100644 src/EventHub.Application.Contracts/Events/AddSessionDto.cs create mode 100644 src/EventHub.Application.Contracts/Events/AddTractDto.cs create mode 100644 src/EventHub.Application.Contracts/Events/TrackDto.cs delete mode 100644 src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs create mode 100644 src/EventHub.HttpApi/Controllers/Events/EventController.cs rename src/{EventHub.HttpApi.Host => EventHub.HttpApi}/Controllers/Events/Registrations/EventRegistrationController.cs (94%) rename src/{EventHub.HttpApi.Host => EventHub.HttpApi}/Controllers/Organizations/Memberships/OrganizationMembershipController.cs (94%) rename src/{EventHub.HttpApi.Host => EventHub.HttpApi}/Controllers/Organizations/OrganizationController.cs (96%) rename src/{EventHub.HttpApi.Host => EventHub.HttpApi}/Controllers/Users/UserController.cs (88%) create mode 100644 src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs create mode 100644 src/EventHub.Web/Pages/Events/Components/CreateEventArea/Default.cshtml create mode 100644 src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml create mode 100644 src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml create mode 100644 src/EventHub.Web/Pages/Events/Components/CreateEventArea/_progressSection.cshtml create mode 100644 src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js diff --git a/src/EventHub.Application.Contracts/Events/AddSessionDto.cs b/src/EventHub.Application.Contracts/Events/AddSessionDto.cs new file mode 100644 index 0000000..6a8d3ac --- /dev/null +++ b/src/EventHub.Application.Contracts/Events/AddSessionDto.cs @@ -0,0 +1,23 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace EventHub.Events; + +public class AddSessionDto +{ + public Guid TrackId { get; set; } + + [Required] + [StringLength(SessionConsts.MaxTitleLength, MinimumLength = SessionConsts.MinTitleLength)] + public string Title { get; set; } + + public DateTime StartTime { get; set; } + + public DateTime EndTime { get; set; } + + [Required] + [StringLength(SessionConsts.MaxDescriptionLength, MinimumLength = SessionConsts.MinDescriptionLength)] + public string Description { get; set; } + + public string Language { get; set; } +} diff --git a/src/EventHub.Application.Contracts/Events/AddTractDto.cs b/src/EventHub.Application.Contracts/Events/AddTractDto.cs new file mode 100644 index 0000000..a0e2663 --- /dev/null +++ b/src/EventHub.Application.Contracts/Events/AddTractDto.cs @@ -0,0 +1,10 @@ +using System.ComponentModel.DataAnnotations; + +namespace EventHub.Events; + +public class AddTractDto +{ + [Required] + [StringLength(TrackConsts.MaxNameLength)] + public string Name { get; set; } +} diff --git a/src/EventHub.Application.Contracts/Events/EventDetailDto.cs b/src/EventHub.Application.Contracts/Events/EventDetailDto.cs index ddb3eec..9adea00 100644 --- a/src/EventHub.Application.Contracts/Events/EventDetailDto.cs +++ b/src/EventHub.Application.Contracts/Events/EventDetailDto.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; using Volo.Abp.Application.Dtos; namespace EventHub.Events @@ -40,5 +42,12 @@ namespace EventHub.Events public string Language { get; set; } public int? Capacity { get; set; } + + public List Tracks { get; set; } + + public EventDetailDto() + { + Tracks = new List(); + } } } diff --git a/src/EventHub.Application.Contracts/Events/EventInListDto.cs b/src/EventHub.Application.Contracts/Events/EventInListDto.cs index a2235ac..413779c 100644 --- a/src/EventHub.Application.Contracts/Events/EventInListDto.cs +++ b/src/EventHub.Application.Contracts/Events/EventInListDto.cs @@ -1,9 +1,10 @@ using System; using Volo.Abp.Application.Dtos; +using Volo.Abp.Auditing; namespace EventHub.Events { - public class EventInListDto : EntityDto + public class EventInListDto : EntityDto, IHasModificationTime, IHasCreationTime { public string OrganizationName { get; set; } @@ -30,5 +31,9 @@ namespace EventHub.Events public string UrlCode { get; set; } public string Url { get; set; } + + public DateTime CreationTime { get; } + + public DateTime? LastModificationTime { get; set; } } } diff --git a/src/EventHub.Application.Contracts/Events/IEventAppService.cs b/src/EventHub.Application.Contracts/Events/IEventAppService.cs index 8296d9b..dfae239 100644 --- a/src/EventHub.Application.Contracts/Events/IEventAppService.cs +++ b/src/EventHub.Application.Contracts/Events/IEventAppService.cs @@ -1,11 +1,9 @@ using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Content; -using Volo.Abp.SettingManagement; namespace EventHub.Events { @@ -15,6 +13,8 @@ namespace EventHub.Events Task> GetListAsync(EventListFilterDto input); + Task> GetDraftEventsByUserId(Guid userId); + Task GetByUrlCodeAsync(string urlCode); Task GetLocationAsync(Guid id); @@ -25,24 +25,12 @@ namespace EventHub.Events Task UpdateAsync(Guid id, UpdateEventDto input); + Task AddTrackAsync(Guid id, AddTractDto input); + + Task> GetTracksAsync(Guid id); + Task AddSessionAsync(Guid id, AddSessionDto input); Task GetCoverImageAsync(Guid id); } - - public class AddSessionDto - { - public Guid TrackId { get; set; } - [Required] - [StringLength(SessionConsts.MaxTitleLength, - MinimumLength = SessionConsts.MinTitleLength)] - public string Title { get; set; } - public DateTime StartTime { get; set; } - public DateTime EndTime { get; set; } - [Required] - [StringLength(SessionConsts.MaxDescriptionLength, - MinimumLength = SessionConsts.MinDescriptionLength)] - public string Description { get; set; } - public string Language { get; set; } - } } diff --git a/src/EventHub.Application.Contracts/Events/TrackDto.cs b/src/EventHub.Application.Contracts/Events/TrackDto.cs new file mode 100644 index 0000000..9e9e18b --- /dev/null +++ b/src/EventHub.Application.Contracts/Events/TrackDto.cs @@ -0,0 +1,9 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EventHub.Events; + +public class TrackDto : EntityDto +{ + public string Name { get; set; } +} diff --git a/src/EventHub.Application.Contracts/Events/UpdateEventDto.cs b/src/EventHub.Application.Contracts/Events/UpdateEventDto.cs index 0e1edf6..49a1a49 100644 --- a/src/EventHub.Application.Contracts/Events/UpdateEventDto.cs +++ b/src/EventHub.Application.Contracts/Events/UpdateEventDto.cs @@ -7,6 +7,8 @@ namespace EventHub.Events { public class UpdateEventDto { + //TODO: Add OrganizationId + [Required] [StringLength(EventConsts.MaxTitleLength, MinimumLength = EventConsts.MinTitleLength)] public string Title { get; set; } @@ -45,4 +47,4 @@ namespace EventHub.Events [Range(1, int.MaxValue)] public int? Capacity { get; set; } } -} \ No newline at end of file +} diff --git a/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs b/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs index 72e16f2..f73087a 100644 --- a/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs +++ b/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs @@ -27,10 +27,13 @@ namespace EventHub .Ignore(x => x.OrganizationDisplayName) .Ignore(x => x.IsLiveNow); CreateMap() + .ForMember(x => x.Tracks, memberOptions => memberOptions.MapFrom(m => m.Tracks)) .Ignore(x => x.OrganizationId) .Ignore(x => x.OrganizationName) .Ignore(x => x.OrganizationDisplayName); + CreateMap(); + CreateMap(); CreateMap() diff --git a/src/EventHub.Application/Events/EventAppService.cs b/src/EventHub.Application/Events/EventAppService.cs index b70bd38..f8f08b7 100644 --- a/src/EventHub.Application/Events/EventAppService.cs +++ b/src/EventHub.Application/Events/EventAppService.cs @@ -12,7 +12,6 @@ using Volo.Abp.Authorization; using Volo.Abp.BlobStoring; using Volo.Abp.Content; using Volo.Abp.Domain.Repositories; -using Volo.Abp.Identity; using Volo.Abp.Users; namespace EventHub.Events @@ -79,6 +78,8 @@ namespace EventHub.Events await SaveCoverImageAsync(@event.Id, input.CoverImageStreamContent); } + @event.Publish(false); + await _eventRepository.InsertAsync(@event); return ObjectMapper.Map(@event); @@ -92,7 +93,8 @@ namespace EventHub.Events var query = from @event in eventQueryable join organization in organizationQueryable on @event.OrganizationId equals organization.Id - select new {@event, organization}; + where !@event.IsDraft + select new { @event, organization }; if (input.RegisteredUserId.HasValue) { @@ -147,27 +149,32 @@ namespace EventHub.Events query = query.OrderBy(x => x.@event.StartTime); } - var items = await AsyncExecuter.ToListAsync(query); - var now = Clock.Now; + var items = (await AsyncExecuter.ToListAsync(query)).Select(a => (a.@event, a.organization)).ToList(); - var events = items.Select( - i => - { - var dto = ObjectMapper.Map(i.@event); - dto.OrganizationName = i.organization.Name; - dto.OrganizationDisplayName = i.organization.DisplayName; - dto.IsLiveNow = now.IsBetween(i.@event.StartTime, i.@event.EndTime); - dto.Country = i.@event.CountryName; - return dto; - } - ).ToList(); + var events = GetEventInListDtoFromEventAndOrganizationTupleList(items); return new PagedResultDto(totalCount, events); } + [Authorize] + public async Task> GetDraftEventsByUserId(Guid userId) + { + var eventQueryable = await _eventRepository.GetQueryableAsync(); + var organizationQueryable = await _organizationRepository.GetQueryableAsync(); + + var query = from @event in eventQueryable + join organization in organizationQueryable on @event.OrganizationId equals organization.Id + where organization.OwnerUserId == userId && @event.IsDraft + select new { @event, organization }; + + var items = (await AsyncExecuter.ToListAsync(query)).Select(a => (a.@event, a.organization)).ToList(); + + return GetEventInListDtoFromEventAndOrganizationTupleList(items); + } + public async Task GetByUrlCodeAsync(string urlCode) { - var @event = await _eventRepository.GetAsync(x => x.UrlCode == urlCode); + var @event = await _eventRepository.GetAsync(x => x.UrlCode == urlCode, true); var organization = await _organizationRepository.GetAsync(@event.OrganizationId); var dto = ObjectMapper.Map(@event); @@ -175,7 +182,7 @@ namespace EventHub.Events dto.OrganizationId = organization.Id; dto.OrganizationName = organization.Name; dto.OrganizationDisplayName = organization.DisplayName; - + var user = await _userRepository.GetAsync(organization.OwnerUserId); dto.OwnerUserName = user.UserName; dto.OwnerEmail = user.Email; @@ -232,15 +239,7 @@ namespace EventHub.Events public async Task UpdateAsync(Guid id, UpdateEventDto input) { var @event = await _eventRepository.GetAsync(id); - var organization = await _organizationRepository.GetAsync(@event.OrganizationId); - - if (organization.OwnerUserId != CurrentUser.GetId()) - { - throw new AbpAuthorizationException( - L["EventHub:NotAuthorizedToUpdateEvent", @event.Title], - EventHubErrorCodes.NotAuthorizedToUpdateEvent - ); - } + await CheckOwnerControlAsync(@event); await _eventManager.SetLocationAsync(@event, input.IsOnline, input.OnlineLink, input.CountryId, input.City); @event.SetTitle(input.Title); @@ -257,6 +256,29 @@ namespace EventHub.Events await _eventRepository.UpdateAsync(@event); } + [Authorize] + public async Task AddTrackAsync(Guid id, AddTractDto input) + { + var @event = await _eventRepository.GetAsync(id, true); + await CheckOwnerControlAsync(@event); + + @event.AddTract( + GuidGenerator.Create(), + input.Name + ); + + await _eventRepository.UpdateAsync(@event); + } + + [Authorize] + public async Task> GetTracksAsync(Guid id) + { + var @event = await _eventRepository.GetAsync(id, true); + + return ObjectMapper.Map, List>(@event.Tracks.ToList()); + } + + [Authorize] public async Task AddSessionAsync(Guid id, AddSessionDto input) { var @event = await _eventRepository.GetAsync(id); @@ -277,7 +299,7 @@ namespace EventHub.Events var blobName = id.ToString(); var coverImageStream = await _eventBlobContainer.GetOrNullAsync(blobName); - + if (coverImageStream is null) { return null; @@ -292,5 +314,36 @@ namespace EventHub.Events await _eventBlobContainer.SaveAsync(blobName, streamContent.GetStream(), overrideExisting: true); } + + private async Task CheckOwnerControlAsync(Event @event) + { + var organization = await _organizationRepository.GetAsync(@event.OrganizationId); + + if (organization.OwnerUserId != CurrentUser.GetId()) + { + throw new AbpAuthorizationException( + L["EventHub:NotAuthorizedToUpdateEvent", @event.Title], + EventHubErrorCodes.NotAuthorizedToUpdateEvent + ); + } + } + + private List GetEventInListDtoFromEventAndOrganizationTupleList(List<(Event @event, Organization organization)> items) + { + var now = Clock.Now; + var events = items.Select( + i => + { + var dto = ObjectMapper.Map(i.@event); + dto.OrganizationName = i.organization.Name; + dto.OrganizationDisplayName = i.organization.DisplayName; + dto.IsLiveNow = now.IsBetween(i.@event.StartTime, i.@event.EndTime); + dto.Country = i.@event.CountryName; + return dto; + } + ).ToList(); + + return events; + } } -} \ No newline at end of file +} diff --git a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs index f1650b6..951de36 100644 --- a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs +++ b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs @@ -16,5 +16,6 @@ public const string SessionTimeConflictsWithAnExistingSession = "EventHub:SessionTimeConflictsWithAnExistingSession"; public const string UserNotFound = "EventHub:UserNotFound"; public const string OrganizationNotFound = "EventHub:OrganizationNotFound"; + public const string TrackNameAlreadyExist = "EventHub:TrackNameAlreadyExist"; } } diff --git a/src/EventHub.Domain.Shared/Localization/EventHub/en.json b/src/EventHub.Domain.Shared/Localization/EventHub/en.json index 557c460..f21596f 100644 --- a/src/EventHub.Domain.Shared/Localization/EventHub/en.json +++ b/src/EventHub.Domain.Shared/Localization/EventHub/en.json @@ -152,6 +152,7 @@ "MaxStartTime": "Max Start Time", "Online": "Online", "InPerson": "In Person", - "UpgradeToPremium": "Upgrade To Premium" + "UpgradeToPremium": "Upgrade To Premium", + "EventHub:TrackNameAlreadyExist": "The track {Name} already exists" } } diff --git a/src/EventHub.Domain/Events/Event.cs b/src/EventHub.Domain/Events/Event.cs index eced286..3a1a756 100644 --- a/src/EventHub.Domain/Events/Event.cs +++ b/src/EventHub.Domain/Events/Event.cs @@ -46,7 +46,7 @@ namespace EventHub.Events public bool IsTimingChangeEmailSent { get; set; } - public bool IsDraft { get; set; } + public bool IsDraft { get; private set; } public ICollection Tracks { get; private set; } @@ -127,6 +127,19 @@ namespace EventHub.Events return this; } + public Event AddTract(Guid trackId, string name) + { + if (Tracks.Any(x => x.Name == name)) + { + throw new BusinessException(EventHubErrorCodes.TrackNameAlreadyExist) + .WithData("Name", name); + } + + Tracks.Add(new Track(trackId, this.Id, name)); + + return this; + } + public Event AddSession( Guid trackId, Guid sessionId, @@ -150,6 +163,13 @@ namespace EventHub.Events track.AddSession(sessionId, title, startTime, endTime, description, language); return this; } + + public Event Publish(bool isPublish) + { + IsDraft = isPublish; + + return this; + } private Track GetTrack(Guid trackId) { diff --git a/src/EventHub.Domain/Events/Track.cs b/src/EventHub.Domain/Events/Track.cs index 96970ae..408efb9 100644 --- a/src/EventHub.Domain/Events/Track.cs +++ b/src/EventHub.Domain/Events/Track.cs @@ -26,7 +26,7 @@ namespace EventHub.Events : base(id) { EventId = eventId; - Name = name; + SetName(name); Sessions = new Collection(); } @@ -63,4 +63,4 @@ namespace EventHub.Events return this; } } -} \ No newline at end of file +} diff --git a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Events/EventRepository.cs b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Events/EventRepository.cs index 603824c..e6219b8 100644 --- a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Events/EventRepository.cs +++ b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Events/EventRepository.cs @@ -98,5 +98,10 @@ namespace EventHub.EntityFrameworkCore.Events return await query.ToListAsync(GetCancellationToken(cancellationToken)); } + + public override async Task> WithDetailsAsync() + { + return (await GetQueryableAsync()).Include(x => x.Tracks).ThenInclude(x => x.Sessions); + } } } diff --git a/src/EventHub.HttpApi.Client/EventHubHttpApiClientModule.cs b/src/EventHub.HttpApi.Client/EventHubHttpApiClientModule.cs index 5b3604c..ae2e0fd 100644 --- a/src/EventHub.HttpApi.Client/EventHubHttpApiClientModule.cs +++ b/src/EventHub.HttpApi.Client/EventHubHttpApiClientModule.cs @@ -2,6 +2,7 @@ using Volo.Abp.Http.Client; using Volo.Abp.Modularity; using Payment; +using Volo.Abp.VirtualFileSystem; namespace EventHub { @@ -20,6 +21,11 @@ namespace EventHub typeof(EventHubApplicationContractsModule).Assembly, RemoteServiceName ); + + Configure(options => + { + options.FileSets.AddEmbedded(); + }); } } } diff --git a/src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs b/src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs deleted file mode 100644 index fb63a95..0000000 --- a/src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using EventHub.Events; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp; -using Volo.Abp.Application.Dtos; -using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.Content; -using Volo.Abp.VirtualFileSystem; - -namespace EventHub.Controllers.Events -{ - [RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] - [Area("eventhub")] - [ControllerName("Event")] - [Route("api/eventhub/event")] - public class EventController : AbpController, IEventAppService - { - private readonly IEventAppService _eventAppService; - private readonly IVirtualFileProvider _virtualFileProvider; - - public EventController( - IEventAppService eventAppService, - IVirtualFileProvider virtualFileProvider) - { - _eventAppService = eventAppService; - _virtualFileProvider = virtualFileProvider; - } - - [HttpPost] - public async Task CreateAsync([FromForm] CreateEventDto input) - { - return await _eventAppService.CreateAsync(input); - } - - [HttpGet] - public async Task> GetListAsync(EventListFilterDto input) - { - return await _eventAppService.GetListAsync(input); - } - - [HttpGet] - [Route("by-url-code/{urlCode}")] - public async Task GetByUrlCodeAsync(string urlCode) - { - return await _eventAppService.GetByUrlCodeAsync(urlCode); - } - - [HttpGet] - [Route("location/{id}")] - public async Task GetLocationAsync(Guid id) - { - return await _eventAppService.GetLocationAsync(id); - } - - [HttpGet] - [Route("lookup/countries")] - public async Task> GetCountriesLookupAsync() - { - return await _eventAppService.GetCountriesLookupAsync(); - } - - [HttpGet] - [Route("is-event-owner/{id}")] - public async Task IsEventOwnerAsync(Guid id) - { - return await _eventAppService.IsEventOwnerAsync(id); - } - - [HttpPut] - [Route("{id}")] - public async Task UpdateAsync(Guid id, [FromForm] UpdateEventDto input) - { - await _eventAppService.UpdateAsync(id, input); - } - - [HttpPost] - [Route("{id}/sessions")] - public async Task AddSessionAsync(Guid id, AddSessionDto input) - { - await _eventAppService.AddSessionAsync(id, input); - } - - [HttpGet] - [Route("cover-image/{id}")] - public async Task GetCoverImageAsync(Guid id) - { - var remoteStreamContent = await _eventAppService.GetCoverImageAsync(id); - - if (remoteStreamContent is null) - { - var stream = _virtualFileProvider.GetFileInfo("/Images/eh-event.png").CreateReadStream(); - remoteStreamContent = new RemoteStreamContent(stream); - await stream.FlushAsync(); - } - - Response.Headers.Add("Accept-Ranges", "bytes"); - Response.ContentType = remoteStreamContent.ContentType; - - return remoteStreamContent; - } - } -} \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs b/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs index a9eceb1..c944a54 100644 --- a/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs +++ b/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs @@ -52,7 +52,6 @@ namespace EventHub public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); - var hostingEnvironment = context.Services.GetHostingEnvironment(); ConfigureAuthentication(context, configuration); ConfigureLocalization(); diff --git a/src/EventHub.HttpApi/Controllers/EventHubController.cs b/src/EventHub.HttpApi/Controllers/EventHubController.cs index cd809a1..118b647 100644 --- a/src/EventHub.HttpApi/Controllers/EventHubController.cs +++ b/src/EventHub.HttpApi/Controllers/EventHubController.cs @@ -3,13 +3,11 @@ using Volo.Abp.AspNetCore.Mvc; namespace EventHub.Controllers { - /* Inherit your controllers from this class. - */ - public abstract class EventHubController : AbpController + public abstract class EventHubController : AbpControllerBase { protected EventHubController() { LocalizationResource = typeof(EventHubResource); } } -} \ No newline at end of file +} diff --git a/src/EventHub.HttpApi/Controllers/Events/EventController.cs b/src/EventHub.HttpApi/Controllers/Events/EventController.cs new file mode 100644 index 0000000..59a5249 --- /dev/null +++ b/src/EventHub.HttpApi/Controllers/Events/EventController.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using EventHub.Events; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Content; +using Volo.Abp.VirtualFileSystem; + +namespace EventHub.Controllers.Events +{ + [RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] + [Area("eventhubm")] + [ControllerName("Event")] + [Route("api/eventhub/event")] + public class EventController : EventHubController, IEventAppService + { + private readonly IEventAppService _eventAppService; + private readonly IVirtualFileProvider _virtualFileProvider; + + public EventController( + IEventAppService eventAppService, + IVirtualFileProvider virtualFileProvider) + { + _eventAppService = eventAppService; + _virtualFileProvider = virtualFileProvider; + } + + [HttpPost] + public async Task CreateAsync([FromForm] CreateEventDto input) + { + return await _eventAppService.CreateAsync(input); + } + + [HttpGet] + public async Task> GetListAsync(EventListFilterDto input) + { + return await _eventAppService.GetListAsync(input); + } + + [HttpGet] + [Route("draft-events-by-user-id/{userId}")] + public async Task> GetDraftEventsByUserId(Guid userId) + { + return await _eventAppService.GetDraftEventsByUserId(userId); + } + + [HttpGet] + [Route("by-url-code/{urlCode}")] + public async Task GetByUrlCodeAsync(string urlCode) + { + return await _eventAppService.GetByUrlCodeAsync(urlCode); + } + + [HttpGet] + [Route("location/{id}")] + public async Task GetLocationAsync(Guid id) + { + return await _eventAppService.GetLocationAsync(id); + } + + [HttpGet] + [Route("lookup/countries")] + public async Task> GetCountriesLookupAsync() + { + return await _eventAppService.GetCountriesLookupAsync(); + } + + [HttpGet] + [Route("is-event-owner/{id}")] + public async Task IsEventOwnerAsync(Guid id) + { + return await _eventAppService.IsEventOwnerAsync(id); + } + + [HttpPut] + [Route("{id}")] + public async Task UpdateAsync(Guid id, [FromForm] UpdateEventDto input) + { + await _eventAppService.UpdateAsync(id, input); + } + + [HttpPost] + [Route("{id}/tracks")] + public async Task AddTrackAsync(Guid id, AddTractDto input) + { + await _eventAppService.AddTrackAsync(id, input); + } + + [HttpGet] + [Route("{id}/tracks")] + public async Task> GetTracksAsync(Guid id) + { + return await _eventAppService.GetTracksAsync(id); + } + + [HttpPost] + [Route("{id}/sessions")] + public async Task AddSessionAsync(Guid id, AddSessionDto input) + { + await _eventAppService.AddSessionAsync(id, input); + } + + [HttpGet] + [Route("cover-image/{id}")] + public async Task GetCoverImageAsync(Guid id) + { + var remoteStreamContent = await _eventAppService.GetCoverImageAsync(id); + + if (remoteStreamContent is null) + { + var stream = _virtualFileProvider.GetFileInfo("/Images/eh-event.png").CreateReadStream(); + remoteStreamContent = new RemoteStreamContent(stream); + await stream.FlushAsync(); + } + + Response.Headers.Add("Accept-Ranges", "bytes"); + Response.ContentType = remoteStreamContent.ContentType; + + return remoteStreamContent; + } + } +} diff --git a/src/EventHub.HttpApi.Host/Controllers/Events/Registrations/EventRegistrationController.cs b/src/EventHub.HttpApi/Controllers/Events/Registrations/EventRegistrationController.cs similarity index 94% rename from src/EventHub.HttpApi.Host/Controllers/Events/Registrations/EventRegistrationController.cs rename to src/EventHub.HttpApi/Controllers/Events/Registrations/EventRegistrationController.cs index 8eb8341..da392a0 100644 --- a/src/EventHub.HttpApi.Host/Controllers/Events/Registrations/EventRegistrationController.cs +++ b/src/EventHub.HttpApi/Controllers/Events/Registrations/EventRegistrationController.cs @@ -12,7 +12,7 @@ namespace EventHub.Controllers.Events.Registrations [Area("eventhub")] [ControllerName("EventRegistration")] [Route("api/eventhub/event-registration")] - public class EventRegistrationController : AbpController, IEventRegistrationAppService + public class EventRegistrationController : EventHubController, IEventRegistrationAppService { private readonly IEventRegistrationAppService _eventRegistrationAppService; @@ -55,4 +55,4 @@ namespace EventHub.Controllers.Events.Registrations return await _eventRegistrationAppService.IsPastEventAsync(eventId); } } -} \ No newline at end of file +} diff --git a/src/EventHub.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs b/src/EventHub.HttpApi/Controllers/Organizations/Memberships/OrganizationMembershipController.cs similarity index 94% rename from src/EventHub.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs rename to src/EventHub.HttpApi/Controllers/Organizations/Memberships/OrganizationMembershipController.cs index ac1d710..500cdd4 100644 --- a/src/EventHub.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs +++ b/src/EventHub.HttpApi/Controllers/Organizations/Memberships/OrganizationMembershipController.cs @@ -12,7 +12,7 @@ namespace EventHub.Controllers.Organizations.Memberships [Area("eventhub")] [ControllerName("OrganizationMembership")] [Route("api/eventhub/organization-membership")] - public class OrganizationMembershipController : AbpController, IOrganizationMembershipAppService + public class OrganizationMembershipController : EventHubController, IOrganizationMembershipAppService { private readonly IOrganizationMembershipAppService _organizationMembershipAppService; @@ -49,4 +49,4 @@ namespace EventHub.Controllers.Organizations.Memberships return await _organizationMembershipAppService.GetMembersAsync(input); } } -} \ No newline at end of file +} diff --git a/src/EventHub.HttpApi.Host/Controllers/Organizations/OrganizationController.cs b/src/EventHub.HttpApi/Controllers/Organizations/OrganizationController.cs similarity index 96% rename from src/EventHub.HttpApi.Host/Controllers/Organizations/OrganizationController.cs rename to src/EventHub.HttpApi/Controllers/Organizations/OrganizationController.cs index 8b4a7b4..be22d10 100644 --- a/src/EventHub.HttpApi.Host/Controllers/Organizations/OrganizationController.cs +++ b/src/EventHub.HttpApi/Controllers/Organizations/OrganizationController.cs @@ -11,10 +11,10 @@ using Volo.Abp.VirtualFileSystem; namespace EventHub.Controllers.Organizations { [RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] - [Area("eventhub")] + [Area("eventhubm")] [ControllerName("Organization")] [Route("api/eventhub/organization")] - public class OrganizationController : AbpController, IOrganizationAppService + public class OrganizationController : EventHubController, IOrganizationAppService { private readonly IOrganizationAppService _organizationAppService; private readonly IVirtualFileProvider _virtualFileProvider; @@ -86,4 +86,4 @@ namespace EventHub.Controllers.Organizations return remoteStreamContent; } } -} \ No newline at end of file +} diff --git a/src/EventHub.HttpApi.Host/Controllers/Users/UserController.cs b/src/EventHub.HttpApi/Controllers/Users/UserController.cs similarity index 88% rename from src/EventHub.HttpApi.Host/Controllers/Users/UserController.cs rename to src/EventHub.HttpApi/Controllers/Users/UserController.cs index 5364c88..0ac1a38 100644 --- a/src/EventHub.HttpApi.Host/Controllers/Users/UserController.cs +++ b/src/EventHub.HttpApi/Controllers/Users/UserController.cs @@ -8,10 +8,10 @@ using Volo.Abp.AspNetCore.Mvc; namespace EventHub.Controllers.Users { [RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] - [Area("eventhub")] + [Area("eventhubm")] [ControllerName("User")] [Route("/api/eventhub/user")] - public class UserController : AbpController, IUserAppService + public class UserController : EventHubController, IUserAppService { private readonly IUserAppService _userAppService; @@ -27,4 +27,4 @@ namespace EventHub.Controllers.Users return await _userAppService.FindByUserNameAsync(username); } } -} \ No newline at end of file +} diff --git a/src/EventHub.Web/Controllers/EventController.cs b/src/EventHub.Web/Controllers/EventController.cs index fcc385b..3b010fd 100644 --- a/src/EventHub.Web/Controllers/EventController.cs +++ b/src/EventHub.Web/Controllers/EventController.cs @@ -1,3 +1,5 @@ +using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using EventHub.Events; @@ -28,5 +30,18 @@ namespace EventHub.Web.Controllers ViewData = ViewData }; } + + [HttpGet] + [Route("{id}/tracks")] + public async Task GetTracksSection(Guid id) + { + ViewData.Model = await _eventAppService.GetTracksAsync(id); + + return await Task.FromResult(new PartialViewResult + { + ViewName = "~/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml", + ViewData = ViewData + }); + } } -} \ No newline at end of file +} diff --git a/src/EventHub.Web/Controllers/EventRegistrationController.cs b/src/EventHub.Web/Controllers/EventRegistrationController.cs index 8548ffb..80cfd8c 100644 --- a/src/EventHub.Web/Controllers/EventRegistrationController.cs +++ b/src/EventHub.Web/Controllers/EventRegistrationController.cs @@ -1,7 +1,6 @@ using System; using System.Threading.Tasks; using EventHub.Events.Registrations; -using EventHub.Web.Pages.Events.Components.RegistrationArea; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc; @@ -29,14 +28,5 @@ namespace EventHub.Web.Controllers await _eventRegistrationAppService.UnregisterAsync(eventId); return NoContent(); } - - [HttpGet] - public IActionResult Widget(Guid eventId) - { - return ViewComponent( - typeof(RegistrationAreaViewComponent), - new {eventId} - ); - } } } diff --git a/src/EventHub.Web/Controllers/OrganizationMembershipController.cs b/src/EventHub.Web/Controllers/OrganizationMembershipController.cs index 7e05755..2f95118 100644 --- a/src/EventHub.Web/Controllers/OrganizationMembershipController.cs +++ b/src/EventHub.Web/Controllers/OrganizationMembershipController.cs @@ -2,7 +2,6 @@ using System; using System.Linq; using System.Threading.Tasks; using EventHub.Organizations.Memberships; -using EventHub.Web.Pages.Organizations.Components.JoinArea; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc; @@ -43,14 +42,5 @@ namespace EventHub.Web.Controllers await _organizationMembershipAppService.LeaveAsync(organizationId); return NoContent(); } - - [HttpGet] - public IActionResult Widget(Guid organizationId) - { - return ViewComponent( - typeof(JoinAreaViewComponent), - new {organizationId} - ); - } } -} \ No newline at end of file +} diff --git a/src/EventHub.Web/Controllers/WidgetsController.cs b/src/EventHub.Web/Controllers/WidgetsController.cs index be191a4..ec3e0dd 100644 --- a/src/EventHub.Web/Controllers/WidgetsController.cs +++ b/src/EventHub.Web/Controllers/WidgetsController.cs @@ -1,6 +1,9 @@ using System; using EventHub.Web.Pages.Events.Components.AttendeesArea; +using EventHub.Web.Pages.Events.Components.CreateEventArea; using EventHub.Web.Pages.Events.Components.LocationArea; +using EventHub.Web.Pages.Events.Components.RegistrationArea; +using EventHub.Web.Pages.Organizations.Components.JoinArea; using EventHub.Web.Pages.Organizations.Components.MembersArea; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc; @@ -47,5 +50,32 @@ namespace EventHub.Web.Controllers new {eventId} ); } + + [HttpGet] + public IActionResult RegistrationArea(Guid eventId) + { + return ViewComponent( + typeof(RegistrationAreaViewComponent), + new {eventId} + ); + } + + [HttpGet] + public IActionResult JoinArea(Guid organizationId) + { + return ViewComponent( + typeof(JoinAreaViewComponent), + new {organizationId} + ); + } + + [HttpGet] + public IActionResult CreateEventArea(string eventUrlCode) + { + return ViewComponent( + typeof(CreateEventAreaViewComponent), + new {eventUrlCode} + ); + } } } diff --git a/src/EventHub.Web/EventHubWebAutoMapperProfile.cs b/src/EventHub.Web/EventHubWebAutoMapperProfile.cs index 014ea33..f036314 100644 --- a/src/EventHub.Web/EventHubWebAutoMapperProfile.cs +++ b/src/EventHub.Web/EventHubWebAutoMapperProfile.cs @@ -1,6 +1,7 @@ using AutoMapper; using EventHub.Events; using EventHub.Organizations; +using EventHub.Web.Pages.Events.Components.CreateEventArea; using EventHub.Web.Pages.Organizations; using Volo.Abp.AutoMapper; using EditPageModel = EventHub.Web.Pages.Events.EditPageModel; @@ -12,10 +13,11 @@ namespace EventHub.Web public EventHubWebAutoMapperProfile() { CreateMap(); - CreateMap() + CreateMap() .Ignore(x => x.CoverImageStreamContent); CreateMap(); CreateMap(); + CreateMap(); CreateMap(); CreateMap(); } diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs new file mode 100644 index 0000000..1e211a7 --- /dev/null +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs @@ -0,0 +1,175 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Globalization; +using System.Linq; +using System.Threading.Tasks; +using EventHub.Events; +using EventHub.Organizations; +using EventHub.Web.Helpers; +using JetBrains.Annotations; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; +using Volo.Abp.Users; + +namespace EventHub.Web.Pages.Events.Components.CreateEventArea; + +[Widget( + AutoInitialize = true, + RefreshUrl = "/Widgets/CreateEventArea", + ScriptFiles = new[] { "/Pages/Events/Components/CreateEventArea/create-event-area.js" } +)] +public class CreateEventAreaViewComponent : AbpViewComponent +{ + private readonly IEventAppService _eventAppService; + private readonly IOrganizationAppService _organizationAppService; + + private readonly ICurrentUser _currentUser; + + public CreateEventAreaViewComponent( + IEventAppService eventAppService, + IOrganizationAppService organizationAppService, + ICurrentUser currentUser) + { + _eventAppService = eventAppService; + _organizationAppService = organizationAppService; + _currentUser = currentUser; + } + + public async Task InvokeAsync(string eventUrlCode) + { + NewEventViewModel model = null; + if (!eventUrlCode.IsNullOrWhiteSpace()) + { + var @event = await _eventAppService.GetByUrlCodeAsync(eventUrlCode); + model = ObjectMapper.Map(@event); + ViewData["EventId"] = @event.Id; + } + + model ??= new NewEventViewModel + { + StartTime = DateTime.Now.ClearTime().AddDays(1).AddHours(19), + EndTime = DateTime.Now.ClearTime().AddDays(1).AddHours(21) + }; + + ViewData["Organizations"] = await GetOrganizationsSelectItemAsync(); + ViewData["Countries"] = await GetCountriesSelectItemAsync(); + ViewData["Languages"] = GetLanguagesSelectItem(); + + return View("~/Pages/Events/Components/CreateEventArea/Default.cshtml", model); + } + + private async Task> GetOrganizationsSelectItemAsync() + { + var result = await _organizationAppService.GetOrganizationsByUserIdAsync(_currentUser.GetId()); + + return result.Items.Select( + organization => new SelectListItem + { + Value = organization.Id.ToString(), + Text = organization.DisplayName + } + ).ToList(); + } + + private async Task> GetCountriesSelectItemAsync() + { + var result = await _eventAppService.GetCountriesLookupAsync(); + + return result.Select( + country => new SelectListItem + { + Value = country.Id.ToString(), + Text = country.Name + } + ).ToList(); + } + + private List GetLanguagesSelectItem() + { + var result = CultureInfo.GetCultures(CultureTypes.NeutralCultures) + .DistinctBy(x => x.EnglishName) + .OrderBy(x => x.EnglishName) + .ToList(); + result.Remove(result.Single(x => x.TwoLetterISOLanguageName == "iv")); // Invariant Language + + return result.Select( + cultureInfo => new SelectListItem + { + Value = cultureInfo.TwoLetterISOLanguageName, + Text = cultureInfo.EnglishName + } + ).ToList(); + } + + public class NewEventViewModel + { + [SelectItems(nameof(Organizations))] + [DisplayName("Organization")] + public Guid OrganizationId { get; set; } + + [Required] + [StringLength(EventConsts.MaxTitleLength, MinimumLength = EventConsts.MinTitleLength)] + public string Title { get; set; } + + [Required] + [DataType(DataType.DateTime)] + public DateTime StartTime { get; set; } = DateTime.Now; + + [Required] + [DataType(DataType.DateTime)] + public DateTime EndTime { get; set; } = DateTime.Now; + + [Required] + [StringLength(EventConsts.MaxDescriptionLength, MinimumLength = EventConsts.MinDescriptionLength)] + [TextArea] + public string Description { get; set; } + + [CanBeNull] + [Display(Name = "Cover Image")] + [DataType(DataType.Upload)] + [MaxFileSize(EventConsts.MaxCoverImageFileSize)] + [AllowedExtensions(new string[] { ".jpg", ".png", ".jpeg" })] + public IFormFile CoverImageFile { get; set; } + + [Required] public bool? IsOnline { get; set; } + + [CanBeNull] + [StringLength(EventConsts.MaxOnlineLinkLength, MinimumLength = EventConsts.MinOnlineLinkLength)] + public string OnlineLink { get; set; } + + [SelectItems(nameof(Countries))] + [DisplayName("Country")] + public Guid? CountryId { get; set; } + + [CanBeNull] + [StringLength(EventConsts.MaxCityLength, MinimumLength = EventConsts.MinCityLength)] + public string City { get; set; } + + [DisplayName("Language")] + public string Language { get; set; } + + [Range(1, int.MaxValue)] + public int? Capacity { get; set; } + + public List Tracks { get; set; } + + public NewEventViewModel() + { + Tracks = new List(); + } + } + + public enum ProgressStepType : byte + { + NewEvent = 0, + NewTrack, + NewSession + } +} diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/Default.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/Default.cshtml new file mode 100644 index 0000000..5ad93a9 --- /dev/null +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/Default.cshtml @@ -0,0 +1,21 @@ +@using Microsoft.AspNetCore.Http +@model EventHub.Web.Pages.Events.Components.CreateEventArea.CreateEventAreaViewComponent.NewEventViewModel + +@{ + if (Model is null) + { + throw new BadHttpRequestException(""); + } + + var eventId = ViewData["EventId"] as Guid?; +} + +
+ +
+ + + + diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml new file mode 100644 index 0000000..87ec346 --- /dev/null +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml @@ -0,0 +1,71 @@ +@using EventHub.Web.Pages.Events.Components.CreateEventArea +@model List + + + +@if (Model is not null) +{ +
+
+
+
+

Add Track

+
+ @foreach (var track in Model) + { +
+
+ @track.Name + Edit +
+
+ } +
+ +
+
+
+ + +
+
+
+ + @* Add Track modal *@ + +} + diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml new file mode 100644 index 0000000..fa1d7f0 --- /dev/null +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml @@ -0,0 +1,143 @@ +@using EventHub.Web.Pages.Events.Components.CreateEventArea +@using Microsoft.AspNetCore.Http +@model EventHub.Web.Pages.Events.Components.CreateEventArea.CreateEventAreaViewComponent.NewEventViewModel + +@{ + var organizations = ViewData["Organizations"] as IList; + if (organizations is null || !organizations.Any()) + { + throw new BadHttpRequestException("There is no organization"); + } + + var countries = ViewData["Countries"] as IList; + if (countries is null || !countries.Any()) + { + throw new BadHttpRequestException("There is no country"); + } + + var languages = ViewData["Languages"] as IList; + if (languages is null || !languages.Any()) + { + throw new BadHttpRequestException("There is no language"); + } +} + + + +
+
+
+
+
+
+

Create New Event

+
+
+
+
+ + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + +
+
+
+

Cover Image

+
+
+
+
+
+
+

For horizontal format 600x400 sized upload images.

+ + + +
+
+
+
+
+ + +
+ +
+
+ + + +
+
+
+ + +
+
+
+ + + +
+
+
+ + +
+
+ +
+
+
+
+
+
+
+
+
diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_progressSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_progressSection.cshtml new file mode 100644 index 0000000..7d99cc8 --- /dev/null +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_progressSection.cshtml @@ -0,0 +1,15 @@ +@using EventHub.Web.Pages.Events.Components.CreateEventArea +@model EventHub.Web.Pages.Events.Components.CreateEventArea.CreateEventAreaViewComponent.ProgressStepType + +
+
+
    +
  • 1New Event
  • +
  • 2Add Track
  • +
  • 3Add Session
  • +
+
+
+
+
+
diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js new file mode 100644 index 0000000..a044a02 --- /dev/null +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js @@ -0,0 +1,69 @@ +(function () { + abp.widgets.CreateEventArea = function ($wrapper) { + var eventApiService = eventHub.controllers.events.event; + var eventIdInput = $('#EventId'); + + if (eventIdInput.val().length === 36) { + // TODO: Add organization in UppdateEventDto + $('#OrganizationId').prop("disabled", true).removeAttr('name'); + } + + $("#CreateEventForm").submit(function (e) { + e.preventDefault(); + if (!$(this).valid()) { + return false; + } + var input = $(this).serializeFormToObject(); + + if (eventIdInput.val().length === 36) { + eventApiService.update(eventIdInput.val(), input).then(function (eventUpdatedResponse) { + abp.notify.success('Updated event'); + SwitchToTrackCreation() + ScrollToWrapperBegin(); + }); + } else { + eventApiService.create(input).then(function (eventCreatedResponse) { + abp.notify.success('Created event as a draft'); + eventIdInput.val(eventCreatedResponse.id); + SwitchToTrackCreation() + ScrollToWrapperBegin(); + }); + } + }); + + + function ScrollToWrapperBegin() { + $([document.documentElement, document.body]).animate({ + scrollTop: $wrapper.offset().top + }, 100); + } + + function SwitchToTrackCreation() { + $('#CreateEventContainer').css('display', 'none'); + $('#CreateTrackContainer').css('display', ''); + AddNewTrackButtonClickEventHandler(); + } + + function AddNewTrackButtonClickEventHandler() { + var addNewTrackButton = $('#AddNewTrackButton'); + addNewTrackButton.click(function (e) { + e.preventDefault(); + var trackName = $('#TrackName').val().trim(); + eventApiService.addTrack(eventIdInput.val(), {name: trackName}).then(function () { + var url = addNewTrackButton.attr('data-url').replace("eventIdPlaceholder", eventIdInput.val()); + abp.ajax({ + type: 'GET', dataType: 'html', contentType: 'text/html; charset=utf-8', url: url + }).then(function (getTracksResponse) { + $('#AddTrackModal').modal('hide'); + var createTrackContainer = $wrapper.find('#CreateTrackContainer'); + createTrackContainer.text(""); + createTrackContainer.append(getTracksResponse); + AddNewTrackButtonClickEventHandler(); + }); + + abp.notify.success('Added the track'); + }); + }); + } + } +})(); diff --git a/src/EventHub.Web/Pages/Events/Components/RegistrationArea/RegistrationAreaViewComponent.cs b/src/EventHub.Web/Pages/Events/Components/RegistrationArea/RegistrationAreaViewComponent.cs index 0582c11..6318f7d 100644 --- a/src/EventHub.Web/Pages/Events/Components/RegistrationArea/RegistrationAreaViewComponent.cs +++ b/src/EventHub.Web/Pages/Events/Components/RegistrationArea/RegistrationAreaViewComponent.cs @@ -10,7 +10,7 @@ namespace EventHub.Web.Pages.Events.Components.RegistrationArea { [Widget( AutoInitialize = true, - RefreshUrl = "/EventRegistration/Widget", + RefreshUrl = "/Widgets/RegistrationArea", ScriptFiles = new[] {"/Pages/Events/Components/RegistrationArea/registration-area.js"} )] public class RegistrationAreaViewComponent : AbpViewComponent diff --git a/src/EventHub.Web/Pages/Events/New.cshtml b/src/EventHub.Web/Pages/Events/New.cshtml index 28d668e..de343d8 100644 --- a/src/EventHub.Web/Pages/Events/New.cshtml +++ b/src/EventHub.Web/Pages/Events/New.cshtml @@ -1,6 +1,7 @@ -@page "/events/new" +@page "/events/new/{eventUrlCode?}" @inject IHtmlLocalizer L @using EventHub.Localization +@using EventHub.Web.Pages.Events.Components.CreateEventArea @using Microsoft.AspNetCore.Mvc.Localization @model EventHub.Web.Pages.Events.NewPageModel @@ -8,138 +9,86 @@ } -@if (!Model.Organizations.Any()) -{ -
-
-
-
-
-

@L["NewEventYouHaveNoOrganizationYetMessage"]

- @L["CreateAnOrganization"] +
+ @if (!Model.IsHasOrganizations) + { +
+
+
+
+

@L["NewEventYouHaveNoOrganizationYetMessage"]

+ @L["CreateAnOrganization"] +
-
+
-
-
-} -else -{ -
-
-
-
-
-
-

Create New Event

-
-
-
-
- - -
-
-
-
- - -
-
-
-
- - - -
-
-
-
- - - -
-
-
-
- - -
-
-
-

Cover Image

-
-
-
-
-
-
-

For horizontal format 600x400 sized upload images.

- - - -
-
-
-
-
- - -
- -
-
- - - -
-
-
- - -
-
-
- - - -
-
-
- - -
-
- -
-
-
-
-
-
-
-} \ No newline at end of file +
+ } + else + { + @await Component.InvokeAsync(typeof(CreateEventAreaViewComponent), new + { + eventUrlCode = Model.EventUrlCode + }) + } +
diff --git a/src/EventHub.Web/Pages/Events/New.cshtml.cs b/src/EventHub.Web/Pages/Events/New.cshtml.cs index d663a90..8e89c1b 100644 --- a/src/EventHub.Web/Pages/Events/New.cshtml.cs +++ b/src/EventHub.Web/Pages/Events/New.cshtml.cs @@ -1,180 +1,52 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.DataAnnotations; -using System.Globalization; -using System.IO; using System.Linq; using System.Threading.Tasks; using EventHub.Events; using EventHub.Organizations; -using EventHub.Web.Helpers; -using JetBrains.Annotations; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Rendering; -using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; -using Volo.Abp.Content; using Volo.Abp.Users; namespace EventHub.Web.Pages.Events { public class NewPageModel : EventHubPageModel { - [BindProperty] - public NewEventViewModel Event { get; set; } + [BindProperty(SupportsGet = true)] + public string EventUrlCode { get; set; } - public List Organizations { get; private set; } - public List Countries { get; private set; } - public List Languages { get; private set; } + [BindProperty(SupportsGet = true)] + public bool IsCreateNew { get; set; } + + public bool IsHasOrganizations { get; set; } + + public List DraftEventList { get; set; } private readonly IEventAppService _eventAppService; private readonly IOrganizationAppService _organizationAppService; public NewPageModel( - IEventAppService eventAppService, + IEventAppService eventAppService, IOrganizationAppService organizationAppService) { _eventAppService = eventAppService; _organizationAppService = organizationAppService; + + DraftEventList = new List(); } public async Task OnGetAsync() { - Event = new NewEventViewModel - { - StartTime = DateTime.Now.ClearTime().AddDays(1).AddHours(19), - EndTime = DateTime.Now.ClearTime().AddDays(1).AddHours(21) - }; + IsHasOrganizations = (await _organizationAppService.GetOrganizationsByUserIdAsync(CurrentUser.GetId())).Items.Any(); - await FillOrganizationsAsync(); - await FillCountriesAsync(); - FillLanguages(); - } - - public async Task OnPostAsync() - { - try + if (!EventUrlCode.IsNullOrWhiteSpace()) { - ValidateModel(); - - var createEventDto = ObjectMapper.Map(Event); - - await using var memoryStream = new MemoryStream(); - if (Event.CoverImageFile != null && Event.CoverImageFile.Length > 0) - { - await Event.CoverImageFile.CopyToAsync(memoryStream); - memoryStream.Position = 0; - - createEventDto.CoverImageStreamContent = new RemoteStreamContent(memoryStream, fileName: Event.CoverImageFile.FileName, contentType: Event.CoverImageFile.ContentType); - } - - var eventDto = await _eventAppService.CreateAsync(createEventDto); - await memoryStream.DisposeAsync(); - - return RedirectToPage("/Events/Detail", new {url = eventDto.UrlCode}); + return; } - catch (Exception exception) + + if (IsHasOrganizations && !IsCreateNew) { - ShowAlert(exception); - await FillOrganizationsAsync(); - await FillCountriesAsync(); - FillLanguages(); - return Page(); + DraftEventList = await _eventAppService.GetDraftEventsByUserId(CurrentUser.GetId()); } } - - private async Task FillOrganizationsAsync() - { - var result = await _organizationAppService.GetOrganizationsByUserIdAsync(CurrentUser.GetId()); - Organizations = result.Items.Select( - organization => new SelectListItem - { - Value = organization.Id.ToString(), - Text = organization.DisplayName - } - ).ToList(); - } - - private async Task FillCountriesAsync() - { - var result = await _eventAppService.GetCountriesLookupAsync(); - - Countries = result.Select( - country => new SelectListItem - { - Value = country.Id.ToString(), - Text = country.Name - } - ).ToList(); - } - - private void FillLanguages() - { - var result = CultureInfo.GetCultures(CultureTypes.NeutralCultures) - .DistinctBy(x => x.EnglishName) - .OrderBy(x => x.EnglishName) - .ToList(); - result.Remove(result.Single(x => x.TwoLetterISOLanguageName == "iv")); // Invariant Language - - Languages = result.Select( - cultureInfo => new SelectListItem - { - Value = cultureInfo.TwoLetterISOLanguageName, - Text = cultureInfo.EnglishName - } - ).ToList(); - } - - public class NewEventViewModel - { - [SelectItems(nameof(Organizations))] - [DisplayName("Organization")] - public Guid OrganizationId { get; set; } - - [Required] - [StringLength(EventConsts.MaxTitleLength, MinimumLength = EventConsts.MinTitleLength)] - public string Title { get; set; } - - [Required] - [DataType(DataType.DateTime)] - public DateTime StartTime { get; set; } = DateTime.Now; - - [Required] - [DataType(DataType.DateTime)] - public DateTime EndTime { get; set; } = DateTime.Now; - - [Required] - [StringLength(EventConsts.MaxDescriptionLength, MinimumLength = EventConsts.MinDescriptionLength)] - [TextArea] - public string Description { get; set; } - - [CanBeNull] - [Display(Name = "Cover Image")] - [DataType(DataType.Upload)] - [MaxFileSize(EventConsts.MaxCoverImageFileSize)] - [AllowedExtensions(new string[] {".jpg", ".png", ".jpeg"})] - public IFormFile CoverImageFile { get; set; } - - [Required] public bool? IsOnline { get; set; } - - [CanBeNull] - [StringLength(EventConsts.MaxOnlineLinkLength, MinimumLength = EventConsts.MinOnlineLinkLength)] - public string OnlineLink { get; set; } - - [SelectItems(nameof(Countries))] - [DisplayName("Country")] - public Guid? CountryId { get; set; } - - [CanBeNull] - [StringLength(EventConsts.MaxCityLength, MinimumLength = EventConsts.MinCityLength)] - public string City { get; set; } - - [SelectItems(nameof(Languages))] - [DisplayName("Language")] - public string Language { get; set; } - - [Range(1, int.MaxValue)] public int? Capacity { get; set; } - } } -} \ No newline at end of file +} diff --git a/src/EventHub.Web/Pages/Organizations/Components/JoinArea/JoinAreaViewComponent.cs b/src/EventHub.Web/Pages/Organizations/Components/JoinArea/JoinAreaViewComponent.cs index 12a1096..fec6dbb 100644 --- a/src/EventHub.Web/Pages/Organizations/Components/JoinArea/JoinAreaViewComponent.cs +++ b/src/EventHub.Web/Pages/Organizations/Components/JoinArea/JoinAreaViewComponent.cs @@ -10,7 +10,7 @@ namespace EventHub.Web.Pages.Organizations.Components.JoinArea { [Widget( AutoInitialize = true, - RefreshUrl = "/OrganizationMembership/Widget", + RefreshUrl = "/Widgets/JoinArea", ScriptFiles = new[] {"/Pages/Organizations/Components/JoinArea/join-area.js"} )] public class JoinAreaViewComponent : AbpViewComponent @@ -49,4 +49,4 @@ namespace EventHub.Web.Pages.Organizations.Components.JoinArea public bool IsJoined { get; set; } } } -} \ No newline at end of file +} diff --git a/src/EventHub.Web/Pages/Pricing.cshtml b/src/EventHub.Web/Pages/Pricing.cshtml index 02da933..135bd4d 100644 --- a/src/EventHub.Web/Pages/Pricing.cshtml +++ b/src/EventHub.Web/Pages/Pricing.cshtml @@ -9,7 +9,7 @@ }
-

Eventhub Pricing List

+

Pricing

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ut nulla consequat, tempus sapien in, pellentesque nunc. Sed at nunc pellentesque, fermentum mi et, fermentum massa.

From 85d69d8cade759540d38d28ff7c4429a11f1250f Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Fri, 10 Dec 2021 11:45:14 +0300 Subject: [PATCH 13/44] refactor: add new track feature --- .../Events/IEventAppService.cs | 2 - .../Events/EventAppService.cs | 8 -- src/EventHub.Domain/Events/Event.cs | 4 +- .../Controllers/Events/EventController.cs | 7 -- .../Components/MainNavbar/Default.cshtml | 6 +- .../Controllers/EventController.cs | 15 --- .../Controllers/WidgetsController.cs | 8 +- .../CreateEventAreaViewComponent.cs | 10 +- .../Components/CreateEventArea/Default.cshtml | 16 ++- .../CreateEventArea/_addTrackSection.cshtml | 3 +- .../CreateEventArea/create-event-area.js | 108 +++++++++++------- src/EventHub.Web/Pages/Events/New.cshtml | 3 +- 12 files changed, 98 insertions(+), 92 deletions(-) diff --git a/src/EventHub.Application.Contracts/Events/IEventAppService.cs b/src/EventHub.Application.Contracts/Events/IEventAppService.cs index dfae239..59b5011 100644 --- a/src/EventHub.Application.Contracts/Events/IEventAppService.cs +++ b/src/EventHub.Application.Contracts/Events/IEventAppService.cs @@ -26,8 +26,6 @@ namespace EventHub.Events Task UpdateAsync(Guid id, UpdateEventDto input); Task AddTrackAsync(Guid id, AddTractDto input); - - Task> GetTracksAsync(Guid id); Task AddSessionAsync(Guid id, AddSessionDto input); diff --git a/src/EventHub.Application/Events/EventAppService.cs b/src/EventHub.Application/Events/EventAppService.cs index f8f08b7..52cc28f 100644 --- a/src/EventHub.Application/Events/EventAppService.cs +++ b/src/EventHub.Application/Events/EventAppService.cs @@ -270,14 +270,6 @@ namespace EventHub.Events await _eventRepository.UpdateAsync(@event); } - [Authorize] - public async Task> GetTracksAsync(Guid id) - { - var @event = await _eventRepository.GetAsync(id, true); - - return ObjectMapper.Map, List>(@event.Tracks.ToList()); - } - [Authorize] public async Task AddSessionAsync(Guid id, AddSessionDto input) { diff --git a/src/EventHub.Domain/Events/Event.cs b/src/EventHub.Domain/Events/Event.cs index 3a1a756..0eb92b6 100644 --- a/src/EventHub.Domain/Events/Event.cs +++ b/src/EventHub.Domain/Events/Event.cs @@ -164,9 +164,9 @@ namespace EventHub.Events return this; } - public Event Publish(bool isPublish) + public Event Publish(bool isPublish = true) { - IsDraft = isPublish; + IsDraft = !isPublish; return this; } diff --git a/src/EventHub.HttpApi/Controllers/Events/EventController.cs b/src/EventHub.HttpApi/Controllers/Events/EventController.cs index 59a5249..9c0bcc4 100644 --- a/src/EventHub.HttpApi/Controllers/Events/EventController.cs +++ b/src/EventHub.HttpApi/Controllers/Events/EventController.cs @@ -88,13 +88,6 @@ namespace EventHub.Controllers.Events await _eventAppService.AddTrackAsync(id, input); } - [HttpGet] - [Route("{id}/tracks")] - public async Task> GetTracksAsync(Guid id) - { - return await _eventAppService.GetTracksAsync(id); - } - [HttpPost] [Route("{id}/sessions")] public async Task AddSessionAsync(Guid id, AddSessionDto input) diff --git a/src/EventHub.Web.Theme/Themes/EventHub/Components/MainNavbar/Default.cshtml b/src/EventHub.Web.Theme/Themes/EventHub/Components/MainNavbar/Default.cshtml index 6ba5752..69a219b 100644 --- a/src/EventHub.Web.Theme/Themes/EventHub/Components/MainNavbar/Default.cshtml +++ b/src/EventHub.Web.Theme/Themes/EventHub/Components/MainNavbar/Default.cshtml @@ -48,9 +48,9 @@ + Create
@@ -142,4 +142,4 @@ return route.Split("/")[1].EnsureStartsWith('/').EnsureEndsWith('/'); } -} \ No newline at end of file +} diff --git a/src/EventHub.Web/Controllers/EventController.cs b/src/EventHub.Web/Controllers/EventController.cs index 3b010fd..d87b047 100644 --- a/src/EventHub.Web/Controllers/EventController.cs +++ b/src/EventHub.Web/Controllers/EventController.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using EventHub.Events; @@ -30,18 +28,5 @@ namespace EventHub.Web.Controllers ViewData = ViewData }; } - - [HttpGet] - [Route("{id}/tracks")] - public async Task GetTracksSection(Guid id) - { - ViewData.Model = await _eventAppService.GetTracksAsync(id); - - return await Task.FromResult(new PartialViewResult - { - ViewName = "~/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml", - ViewData = ViewData - }); - } } } diff --git a/src/EventHub.Web/Controllers/WidgetsController.cs b/src/EventHub.Web/Controllers/WidgetsController.cs index ec3e0dd..1f8563f 100644 --- a/src/EventHub.Web/Controllers/WidgetsController.cs +++ b/src/EventHub.Web/Controllers/WidgetsController.cs @@ -70,11 +70,15 @@ namespace EventHub.Web.Controllers } [HttpGet] - public IActionResult CreateEventArea(string eventUrlCode) + public IActionResult CreateEventArea(string eventUrlCode, CreateEventAreaViewComponent.ProgressStepType stepType) { return ViewComponent( typeof(CreateEventAreaViewComponent), - new {eventUrlCode} + new + { + eventUrlCode, + stepType + } ); } } diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs index 1e211a7..337273b 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs @@ -42,7 +42,9 @@ public class CreateEventAreaViewComponent : AbpViewComponent _currentUser = currentUser; } - public async Task InvokeAsync(string eventUrlCode) + public async Task InvokeAsync( + string eventUrlCode, + ProgressStepType stepType = ProgressStepType.NewEvent) { NewEventViewModel model = null; if (!eventUrlCode.IsNullOrWhiteSpace()) @@ -50,14 +52,16 @@ public class CreateEventAreaViewComponent : AbpViewComponent var @event = await _eventAppService.GetByUrlCodeAsync(eventUrlCode); model = ObjectMapper.Map(@event); ViewData["EventId"] = @event.Id; + ViewData["EventUrlCode"] = @event.UrlCode; } model ??= new NewEventViewModel { StartTime = DateTime.Now.ClearTime().AddDays(1).AddHours(19), EndTime = DateTime.Now.ClearTime().AddDays(1).AddHours(21) - }; - + }; + + ViewData["StepType"] = stepType.ToString(); ViewData["Organizations"] = await GetOrganizationsSelectItemAsync(); ViewData["Countries"] = await GetCountriesSelectItemAsync(); ViewData["Languages"] = GetLanguagesSelectItem(); diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/Default.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/Default.cshtml index 5ad93a9..e1b5a46 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/Default.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/Default.cshtml @@ -1,3 +1,4 @@ +@using EventHub.Web.Pages.Events.Components.CreateEventArea @using Microsoft.AspNetCore.Http @model EventHub.Web.Pages.Events.Components.CreateEventArea.CreateEventAreaViewComponent.NewEventViewModel @@ -6,16 +7,23 @@ { throw new BadHttpRequestException(""); } - + var eventId = ViewData["EventId"] as Guid?; + var eventUrlCode = ViewData["EventUrlCode"]?.ToString(); + + var result = Enum.TryParse(ViewData["StepType"]!.ToString(), out CreateEventAreaViewComponent.ProgressStepType stepType); + if (!result) + { + throw new BadHttpRequestException(""); + } } -
+
- diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js index a044a02..1197dcc 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js @@ -1,48 +1,62 @@ (function () { + var stepType = { + "NewEvent": "NewEvent", + "NewTrack": "NewTrack", + "NewSession": "NewSession" + } + abp.widgets.CreateEventArea = function ($wrapper) { + var widgetManager = $wrapper.data('abp-widget-manager'); var eventApiService = eventHub.controllers.events.event; var eventIdInput = $('#EventId'); + var eventUrlCodeInput = $('#EventUrlCode'); - if (eventIdInput.val().length === 36) { - // TODO: Add organization in UppdateEventDto - $('#OrganizationId').prop("disabled", true).removeAttr('name'); + var filter = { + eventUrlCode: "", + stepType: stepType.NewEvent + } + + var getFilters = function () { + return filter; } - $("#CreateEventForm").submit(function (e) { - e.preventDefault(); - if (!$(this).valid()) { - return false; - } - var input = $(this).serializeFormToObject(); - + var init = function () { + console.log(filter) if (eventIdInput.val().length === 36) { - eventApiService.update(eventIdInput.val(), input).then(function (eventUpdatedResponse) { - abp.notify.success('Updated event'); - SwitchToTrackCreation() - ScrollToWrapperBegin(); - }); - } else { - eventApiService.create(input).then(function (eventCreatedResponse) { - abp.notify.success('Created event as a draft'); - eventIdInput.val(eventCreatedResponse.id); - SwitchToTrackCreation() - ScrollToWrapperBegin(); - }); + // TODO: Add organization in UppdateEventDto + $('#OrganizationId').prop("disabled", true).removeAttr('name'); } - }); + $("#CreateEventForm").submit(function (e) { + e.preventDefault(); + if (!$(this).valid()) { + return false; + } + var input = $(this).serializeFormToObject(); - function ScrollToWrapperBegin() { - $([document.documentElement, document.body]).animate({ - scrollTop: $wrapper.offset().top - }, 100); - } + if (eventIdInput.val().length === 36) { + eventApiService.update(eventIdInput.val(), input).then(function () { + abp.notify.success('Updated event'); + SwitchToTrackCreation() + }); + } else { + eventApiService.create(input).then(function (eventCreatedResponse) { + abp.notify.success('Created event as a draft'); + eventIdInput.val(eventCreatedResponse.id); + eventUrlCodeInput.val(eventCreatedResponse.urlCode); + SwitchToTrackCreation() + }); + } + }); + + function SwitchToTrackCreation() { + $('#CreateEventContainer').css('display', 'none'); + $('#CreateTrackContainer').css('display', ''); + ScrollToWrapperBegin(); + } - function SwitchToTrackCreation() { - $('#CreateEventContainer').css('display', 'none'); - $('#CreateTrackContainer').css('display', ''); AddNewTrackButtonClickEventHandler(); - } + }; function AddNewTrackButtonClickEventHandler() { var addNewTrackButton = $('#AddNewTrackButton'); @@ -50,20 +64,28 @@ e.preventDefault(); var trackName = $('#TrackName').val().trim(); eventApiService.addTrack(eventIdInput.val(), {name: trackName}).then(function () { - var url = addNewTrackButton.attr('data-url').replace("eventIdPlaceholder", eventIdInput.val()); - abp.ajax({ - type: 'GET', dataType: 'html', contentType: 'text/html; charset=utf-8', url: url - }).then(function (getTracksResponse) { - $('#AddTrackModal').modal('hide'); - var createTrackContainer = $wrapper.find('#CreateTrackContainer'); - createTrackContainer.text(""); - createTrackContainer.append(getTracksResponse); - AddNewTrackButtonClickEventHandler(); - }); - + $('#AddTrackModal').modal('hide'); abp.notify.success('Added the track'); + FillFilter(stepType.NewTrack) + widgetManager.refresh(); }); }); } + + function FillFilter(stepType) { + filter.stepType = stepType; + filter.eventUrlCode = eventUrlCodeInput.val(); + } + + function ScrollToWrapperBegin() { + $([document.documentElement, document.body]).animate({ + scrollTop: $wrapper.offset().top + }, 100); + } + + return { + getFilters: getFilters, + init: init, + }; } })(); diff --git a/src/EventHub.Web/Pages/Events/New.cshtml b/src/EventHub.Web/Pages/Events/New.cshtml index de343d8..9a4cc36 100644 --- a/src/EventHub.Web/Pages/Events/New.cshtml +++ b/src/EventHub.Web/Pages/Events/New.cshtml @@ -88,7 +88,8 @@ { @await Component.InvokeAsync(typeof(CreateEventAreaViewComponent), new { - eventUrlCode = Model.EventUrlCode + eventUrlCode = Model.EventUrlCode, + stepType = CreateEventAreaViewComponent.ProgressStepType.NewEvent }) }
From 78c7b68ea45ae00e5e988b2e40b536cda1aad08e Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Fri, 10 Dec 2021 16:34:29 +0300 Subject: [PATCH 14/44] feat: Delete and Update track --- .../Events/DeleteTractDto.cs | 6 + .../Events/IEventAppService.cs | 2 + .../Events/EventAppService.cs | 8 ++ .../EventHubErrorCodes.cs | 1 + .../Localization/EventHub/en.json | 3 +- src/EventHub.Domain/Events/Event.cs | 13 +++ .../Controllers/Events/EventController.cs | 7 ++ .../CreateEventArea/_addTrackSection.cshtml | 58 +++++++--- .../CreateEventArea/create-event-area.js | 104 ++++++++++++++++-- 9 files changed, 176 insertions(+), 26 deletions(-) create mode 100644 src/EventHub.Application.Contracts/Events/DeleteTractDto.cs diff --git a/src/EventHub.Application.Contracts/Events/DeleteTractDto.cs b/src/EventHub.Application.Contracts/Events/DeleteTractDto.cs new file mode 100644 index 0000000..fd9d396 --- /dev/null +++ b/src/EventHub.Application.Contracts/Events/DeleteTractDto.cs @@ -0,0 +1,6 @@ +namespace EventHub.Events; + +public class DeleteTractDto +{ + public string Name { get; set; } +} diff --git a/src/EventHub.Application.Contracts/Events/IEventAppService.cs b/src/EventHub.Application.Contracts/Events/IEventAppService.cs index 59b5011..c287748 100644 --- a/src/EventHub.Application.Contracts/Events/IEventAppService.cs +++ b/src/EventHub.Application.Contracts/Events/IEventAppService.cs @@ -27,6 +27,8 @@ namespace EventHub.Events Task AddTrackAsync(Guid id, AddTractDto input); + Task DeleteTrackAsync(Guid id, Guid trackId); + Task AddSessionAsync(Guid id, AddSessionDto input); Task GetCoverImageAsync(Guid id); diff --git a/src/EventHub.Application/Events/EventAppService.cs b/src/EventHub.Application/Events/EventAppService.cs index 52cc28f..75936d5 100644 --- a/src/EventHub.Application/Events/EventAppService.cs +++ b/src/EventHub.Application/Events/EventAppService.cs @@ -270,6 +270,14 @@ namespace EventHub.Events await _eventRepository.UpdateAsync(@event); } + public async Task DeleteTrackAsync(Guid id, Guid trackId) + { + var @event = await _eventRepository.GetAsync(id, true); + await CheckOwnerControlAsync(@event); + + @event.RemoveTrack(trackId); + } + [Authorize] public async Task AddSessionAsync(Guid id, AddSessionDto input) { diff --git a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs index 951de36..572a9f4 100644 --- a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs +++ b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs @@ -17,5 +17,6 @@ public const string UserNotFound = "EventHub:UserNotFound"; public const string OrganizationNotFound = "EventHub:OrganizationNotFound"; public const string TrackNameAlreadyExist = "EventHub:TrackNameAlreadyExist"; + public const string TrackNotFound = "EventHub:TrackNotFound"; } } diff --git a/src/EventHub.Domain.Shared/Localization/EventHub/en.json b/src/EventHub.Domain.Shared/Localization/EventHub/en.json index f21596f..f933d5e 100644 --- a/src/EventHub.Domain.Shared/Localization/EventHub/en.json +++ b/src/EventHub.Domain.Shared/Localization/EventHub/en.json @@ -153,6 +153,7 @@ "Online": "Online", "InPerson": "In Person", "UpgradeToPremium": "Upgrade To Premium", - "EventHub:TrackNameAlreadyExist": "The track {Name} already exists" + "EventHub:TrackNameAlreadyExist": "The track {Name} already exists", + "EventHub:TrackNotFound": "The track not found!" } } diff --git a/src/EventHub.Domain/Events/Event.cs b/src/EventHub.Domain/Events/Event.cs index 0eb92b6..75e4f65 100644 --- a/src/EventHub.Domain/Events/Event.cs +++ b/src/EventHub.Domain/Events/Event.cs @@ -139,6 +139,19 @@ namespace EventHub.Events return this; } + + public Event RemoveTrack(Guid trackId) + { + var track = Tracks.SingleOrDefault(x => x.Id == trackId); + if (track is null) + { + throw new BusinessException(EventHubErrorCodes.TrackNotFound); + } + + Tracks.Remove(track); + + return this; + } public Event AddSession( Guid trackId, diff --git a/src/EventHub.HttpApi/Controllers/Events/EventController.cs b/src/EventHub.HttpApi/Controllers/Events/EventController.cs index 9c0bcc4..fab0029 100644 --- a/src/EventHub.HttpApi/Controllers/Events/EventController.cs +++ b/src/EventHub.HttpApi/Controllers/Events/EventController.cs @@ -88,6 +88,13 @@ namespace EventHub.Controllers.Events await _eventAppService.AddTrackAsync(id, input); } + [HttpPost] + [Route("{id}/tracks/{trackId}")] + public async Task DeleteTrackAsync(Guid id, Guid trackId) + { + await _eventAppService.DeleteTrackAsync(id, trackId); + } + [HttpPost] [Route("{id}/sessions")] public async Task AddSessionAsync(Guid id, AddSessionDto input) diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml index 8ab4e9c..6806b01 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml @@ -16,7 +16,14 @@
@track.Name - Edit + + + Edit + + + Delete + +
} @@ -31,7 +38,7 @@ -} \ No newline at end of file +} diff --git a/src/EventHub.Web/Pages/Events/EventDateHelper.cs b/src/EventHub.Web/Pages/Events/EventDateHelper.cs index 0aab7c7..2b8605a 100644 --- a/src/EventHub.Web/Pages/Events/EventDateHelper.cs +++ b/src/EventHub.Web/Pages/Events/EventDateHelper.cs @@ -1,4 +1,5 @@ using System; +using System.Globalization; using System.Text; using EventHub.Events; @@ -24,6 +25,16 @@ namespace EventHub.Web.Pages.Events return sb.ToString(); } + public static string GetTimeRangeText(TimeOnly startTime, TimeOnly endTime) + { + var sb = new StringBuilder(); + sb.Append(startTime.ToString("hh tt", CultureInfo.InvariantCulture)); + sb.Append(" - "); + sb.Append(endTime.ToString("hh tt", CultureInfo.InvariantCulture)); + + return sb.ToString(); + } + public static string GetLocationInfo(EventInListDto eventItem) { if (eventItem.IsOnline) From a13984afb6c12d69e80145d1443009842979f0b5 Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Fri, 10 Dec 2021 18:12:40 +0300 Subject: [PATCH 16/44] Create _modelNullErrorSection.cshtml --- .../Components/CreateEventArea/_modelNullErrorSection.cshtml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/EventHub.Web/Pages/Events/Components/CreateEventArea/_modelNullErrorSection.cshtml diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_modelNullErrorSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_modelNullErrorSection.cshtml new file mode 100644 index 0000000..11016ef --- /dev/null +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_modelNullErrorSection.cshtml @@ -0,0 +1,4 @@ +@model EventHub.Web.Pages.Events.Components.CreateEventArea.CreateEventAreaViewComponent.ProgressStepType + +@* TODO: Create content for model null template *@ + From b27752876a00d7ce69a50418406ceec9b3f63f76 Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Tue, 14 Dec 2021 11:38:49 +0300 Subject: [PATCH 17/44] Add model null error template --- .../CreateEventArea/_addSessionSection.cshtml | 3 + .../CreateEventArea/_addTrackSection.cshtml | 4 +- .../_modelNullErrorSection.cshtml | 7 +- .../CreateEventArea/_newEventSection.cshtml | 212 +++++++++--------- 4 files changed, 118 insertions(+), 108 deletions(-) diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml index 36e8c1d..86ac781 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml @@ -62,4 +62,7 @@
+}else +{ + } diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml index 788cf1e..6b894ef 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml @@ -98,5 +98,7 @@
+}else +{ + } - diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_modelNullErrorSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_modelNullErrorSection.cshtml index 11016ef..e12cd3b 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_modelNullErrorSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_modelNullErrorSection.cshtml @@ -1,4 +1,3 @@ -@model EventHub.Web.Pages.Events.Components.CreateEventArea.CreateEventAreaViewComponent.ProgressStepType - -@* TODO: Create content for model null template *@ - +
+

An unknown error has occurred!

+
diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml index fa1d7f0..fb85b2a 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml @@ -8,13 +8,13 @@ { throw new BadHttpRequestException("There is no organization"); } - + var countries = ViewData["Countries"] as IList; if (countries is null || !countries.Any()) { throw new BadHttpRequestException("There is no country"); } - + var languages = ViewData["Languages"] as IList; if (languages is null || !languages.Any()) { @@ -22,116 +22,118 @@ } } - - -
-
-
-
-
-
-

Create New Event

-
-
-
-
- - -
-
-
-
- - - + +@if (Model is not null) +{ + +
+
+
+
+
+

Create New Event

+
+
+
+
+ + +
-
-
-
- - - +
+
+ + + +
-
-
-
- - - +
+
+ + + +
-
-
-
- - +
+
+ + + +
-
-
-

Cover Image

-
-
-
+
+
+ +
-
-
-

For horizontal format 600x400 sized upload images.

- - - +
+
+

Cover Image

+
+
+
+
+
+
+

For horizontal format 600x400 sized upload images.

+ + + +
-
-
- - -
-
-
- + +} +else +{ + +} From bd8f31b9b209e8de7a284363bc51568bf1553a2b Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Tue, 14 Dec 2021 18:11:29 +0300 Subject: [PATCH 18/44] feat: add session --- .../Events/AddSessionDto.cs | 6 +- .../Events/TrackDto.cs | 2 +- .../Users/IUserAppService.cs | 5 +- .../Users/UserInListDto.cs | 6 + .../EventHubApplicationAutoMapperProfile.cs | 2 + .../Events/EventAppService.cs | 18 +- .../Users/UserAppService.cs | 23 ++- src/EventHub.Domain/Events/Session.cs | 13 +- src/EventHub.Domain/Events/Track.cs | 2 +- .../Users/UserWithoutDetails.cs | 10 + .../Controllers/Users/UserController.cs | 10 +- .../wwwroot/themes/eventhub/style.css | 6 +- .../CreateEventAreaViewComponent.cs | 11 +- .../CreateEventArea/_addSessionSection.cshtml | 190 ++++++++++++++---- .../CreateEventArea/_addTrackSection.cshtml | 7 +- .../_modelNullErrorSection.cshtml | 4 +- .../CreateEventArea/create-event-area.css | 0 .../CreateEventArea/create-event-area.js | 64 ++++++ src/EventHub.Web/wwwroot/global-styles.css | 10 +- 19 files changed, 323 insertions(+), 66 deletions(-) create mode 100644 src/EventHub.Application.Contracts/Users/UserInListDto.cs create mode 100644 src/EventHub.Domain/Users/UserWithoutDetails.cs create mode 100644 src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.css diff --git a/src/EventHub.Application.Contracts/Events/AddSessionDto.cs b/src/EventHub.Application.Contracts/Events/AddSessionDto.cs index 6a8d3ac..d91e20d 100644 --- a/src/EventHub.Application.Contracts/Events/AddSessionDto.cs +++ b/src/EventHub.Application.Contracts/Events/AddSessionDto.cs @@ -11,8 +11,12 @@ public class AddSessionDto [StringLength(SessionConsts.MaxTitleLength, MinimumLength = SessionConsts.MinTitleLength)] public string Title { get; set; } + [Required] + [DataType(DataType.DateTime)] public DateTime StartTime { get; set; } - + + [Required] + [DataType(DataType.DateTime)] public DateTime EndTime { get; set; } [Required] diff --git a/src/EventHub.Application.Contracts/Events/TrackDto.cs b/src/EventHub.Application.Contracts/Events/TrackDto.cs index 2a555b9..5b39693 100644 --- a/src/EventHub.Application.Contracts/Events/TrackDto.cs +++ b/src/EventHub.Application.Contracts/Events/TrackDto.cs @@ -7,7 +7,7 @@ namespace EventHub.Events; public class TrackDto : EntityDto { public string Name { get; set; } - + public List Sessions { get; set; } public TrackDto() diff --git a/src/EventHub.Application.Contracts/Users/IUserAppService.cs b/src/EventHub.Application.Contracts/Users/IUserAppService.cs index 6b71d6f..951b8f6 100644 --- a/src/EventHub.Application.Contracts/Users/IUserAppService.cs +++ b/src/EventHub.Application.Contracts/Users/IUserAppService.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Threading.Tasks; using EventHub.Members; using Volo.Abp.Application.Services; @@ -7,5 +8,7 @@ namespace EventHub.Users public interface IUserAppService : IApplicationService { Task FindByUserNameAsync(string username); + + Task> GetListByUserName(string username); } -} \ No newline at end of file +} diff --git a/src/EventHub.Application.Contracts/Users/UserInListDto.cs b/src/EventHub.Application.Contracts/Users/UserInListDto.cs new file mode 100644 index 0000000..52af0a8 --- /dev/null +++ b/src/EventHub.Application.Contracts/Users/UserInListDto.cs @@ -0,0 +1,6 @@ +namespace EventHub.Users; + +public class UserInListDto +{ + public string UserName { get; set; } +} diff --git a/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs b/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs index 4740b6b..0e04144 100644 --- a/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs +++ b/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs @@ -49,6 +49,8 @@ namespace EventHub CreateMap(); CreateMap(); + + CreateMap(); } } } diff --git a/src/EventHub.Application/Events/EventAppService.cs b/src/EventHub.Application/Events/EventAppService.cs index a2dc966..01f669d 100644 --- a/src/EventHub.Application/Events/EventAppService.cs +++ b/src/EventHub.Application/Events/EventAppService.cs @@ -252,12 +252,12 @@ namespace EventHub.Events @event.Language = input.Language; @event.SetTime(input.StartTime, input.EndTime); await _eventManager.SetCapacityAsync(@event, input.Capacity); - + if (input.CoverImageStreamContent != null && input.CoverImageStreamContent.ContentLength > 0) { await SaveCoverImageAsync(@event.Id, input.CoverImageStreamContent); } - + await _eventRepository.UpdateAsync(@event); } @@ -266,28 +266,30 @@ namespace EventHub.Events { var @event = await _eventRepository.GetAsync(id, true); await CheckOwnerControlAsync(@event); - + @event.AddTract( GuidGenerator.Create(), input.Name ); - + await _eventRepository.UpdateAsync(@event); } + [Authorize] public async Task UpdateTrackAsync(Guid id, Guid trackId, UpdateTrackDto input) { var @event = await _eventRepository.GetAsync(id, true); await CheckOwnerControlAsync(@event); - + @event.UpdateTrack( trackId, input.Name ); - + await _eventRepository.UpdateAsync(@event); } + [Authorize] public async Task DeleteTrackAsync(Guid id, Guid trackId) { var @event = await _eventRepository.GetAsync(id, true); @@ -332,7 +334,7 @@ namespace EventHub.Events await _eventBlobContainer.SaveAsync(blobName, streamContent.GetStream(), overrideExisting: true); } - + private async Task CheckOwnerControlAsync(Event @event) { var organization = await _organizationRepository.GetAsync(@event.OrganizationId); @@ -345,7 +347,7 @@ namespace EventHub.Events ); } } - + private List GetEventInListDtoFromEventAndOrganizationTupleList(List<(Event @event, Organization organization)> items) { var now = Clock.Now; diff --git a/src/EventHub.Application/Users/UserAppService.cs b/src/EventHub.Application/Users/UserAppService.cs index 42ed495..e7b095b 100644 --- a/src/EventHub.Application/Users/UserAppService.cs +++ b/src/EventHub.Application/Users/UserAppService.cs @@ -1,7 +1,8 @@ -using System; +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using EventHub.Members; -using Volo.Abp.Domain.Repositories; +using Microsoft.AspNetCore.Authorization; using Volo.Abp.Identity; namespace EventHub.Users @@ -21,5 +22,21 @@ namespace EventHub.Users return ObjectMapper.Map(user); } + + [Authorize] + public async Task> GetListByUserName(string username) + { + var userQueryable = await _userRepository.GetQueryableAsync(); + + var query = userQueryable + .Where(u => u.UserName.Contains(username)) + .Select(x => new UserWithoutDetails + { + Id = x.Id, + UserName = x.UserName + }).Take(10); + + return ObjectMapper.Map, List>(await AsyncExecuter.ToListAsync(query)); + } } -} \ No newline at end of file +} diff --git a/src/EventHub.Domain/Events/Session.cs b/src/EventHub.Domain/Events/Session.cs index 2b6f539..290b4fb 100644 --- a/src/EventHub.Domain/Events/Session.cs +++ b/src/EventHub.Domain/Events/Session.cs @@ -33,13 +33,15 @@ namespace EventHub.Events string title, DateTime startTime, DateTime endTime, - string description) + string description, + string language) : base(id) { TrackId = trackId; SetTitle(title); SetDescription(description); SetTime(startTime, endTime); + SetLanguage(language); Speakers = new Collection(); } @@ -66,5 +68,12 @@ namespace EventHub.Events EndTime = endTime; return this; } + + internal Session SetLanguage(string language) + { + Language = Check.NotNullOrWhiteSpace(language, nameof(language), SessionConsts.MaxLanguageLength); + + return this; + } } -} \ No newline at end of file +} diff --git a/src/EventHub.Domain/Events/Track.cs b/src/EventHub.Domain/Events/Track.cs index 408efb9..bbe90b5 100644 --- a/src/EventHub.Domain/Events/Track.cs +++ b/src/EventHub.Domain/Events/Track.cs @@ -58,7 +58,7 @@ namespace EventHub.Events } } - Sessions.Add(new Session(sessionId, Id, title, startTime, endTime, description)); + Sessions.Add(new Session(sessionId, Id, title, startTime, endTime, description, language)); return this; } diff --git a/src/EventHub.Domain/Users/UserWithoutDetails.cs b/src/EventHub.Domain/Users/UserWithoutDetails.cs new file mode 100644 index 0000000..b02395f --- /dev/null +++ b/src/EventHub.Domain/Users/UserWithoutDetails.cs @@ -0,0 +1,10 @@ +using System; + +namespace EventHub.Users; + +public class UserWithoutDetails +{ + public Guid Id { get; set; } + + public string UserName { get; set; } +} diff --git a/src/EventHub.HttpApi/Controllers/Users/UserController.cs b/src/EventHub.HttpApi/Controllers/Users/UserController.cs index 0ac1a38..9147c3a 100644 --- a/src/EventHub.HttpApi/Controllers/Users/UserController.cs +++ b/src/EventHub.HttpApi/Controllers/Users/UserController.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Threading.Tasks; using EventHub.Members; using EventHub.Users; @@ -10,7 +11,7 @@ namespace EventHub.Controllers.Users [RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] [Area("eventhubm")] [ControllerName("User")] - [Route("/api/eventhub/user")] + [Route("/api/eventhub/users")] public class UserController : EventHubController, IUserAppService { private readonly IUserAppService _userAppService; @@ -26,5 +27,12 @@ namespace EventHub.Controllers.Users { return await _userAppService.FindByUserNameAsync(username); } + + [HttpGet] + [Route("contains/{username}")] + public async Task> GetListByUserName(string username) + { + return await _userAppService.GetListByUserName(username); + } } } diff --git a/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css b/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css index bc1f35f..b931deb 100644 --- a/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css +++ b/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css @@ -57,6 +57,10 @@ p { word-wrap: break-word; } +textarea { + height: 90px!important; +} + /*NAVBAR*/ .navbar { box-shadow: 0 5px 10px rgba(0, 4, 74, 0.05) !important; @@ -1092,4 +1096,4 @@ div.checkbox.switcher label input:checked + span small, div.radio.switcher label } } -/*This area was made to be able to navigate between pages. It should be removed from the project*/ \ No newline at end of file +/*This area was made to be able to navigate between pages. It should be removed from the project*/ diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs index 337273b..a7f5b8e 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs @@ -23,7 +23,8 @@ namespace EventHub.Web.Pages.Events.Components.CreateEventArea; [Widget( AutoInitialize = true, RefreshUrl = "/Widgets/CreateEventArea", - ScriptFiles = new[] { "/Pages/Events/Components/CreateEventArea/create-event-area.js" } + ScriptFiles = new[] { "/Pages/Events/Components/CreateEventArea/create-event-area.js" }, + StyleFiles = new[] { "/Pages/Events/Components/CreateEventArea/create-event-area.css" } )] public class CreateEventAreaViewComponent : AbpViewComponent { @@ -54,13 +55,13 @@ public class CreateEventAreaViewComponent : AbpViewComponent ViewData["EventId"] = @event.Id; ViewData["EventUrlCode"] = @event.UrlCode; } - + model ??= new NewEventViewModel { StartTime = DateTime.Now.ClearTime().AddDays(1).AddHours(19), EndTime = DateTime.Now.ClearTime().AddDays(1).AddHours(21) }; - + ViewData["StepType"] = stepType.ToString(); ViewData["Organizations"] = await GetOrganizationsSelectItemAsync(); ViewData["Countries"] = await GetCountriesSelectItemAsync(); @@ -81,7 +82,7 @@ public class CreateEventAreaViewComponent : AbpViewComponent } ).ToList(); } - + private async Task> GetCountriesSelectItemAsync() { var result = await _eventAppService.GetCountriesLookupAsync(); @@ -169,7 +170,7 @@ public class CreateEventAreaViewComponent : AbpViewComponent Tracks = new List(); } } - + public enum ProgressStepType : byte { NewEvent = 0, diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml index 86ac781..62b3eb5 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml @@ -1,50 +1,73 @@ @using EventHub.Web.Pages.Events @using EventHub.Web.Pages.Events.Components.CreateEventArea +@using EventHub.Events +@using Microsoft.AspNetCore.Http @model List - +@{ + var languages = ViewData["Languages"] as IList; + if (languages is null || !languages.Any()) + { + throw new BadHttpRequestException("There is no language"); + } + languages = languages.Select(l => + { + if (l.Value == "en") + { + l.Selected = true; + } + return l; + }).ToList(); +} + + @if (Model is not null) {
-
-
-
-

Add Session

- - +
+
+
+

Add Session

+
+ @foreach (var track in Model) - { - - } - + { + + } + - - @foreach (var track in Model) - { - + @foreach (var track in Model) + { + - } - + + } +
@track.Name
+ @track.Name.TruncateWithPostfix(20) +
- @foreach (var session in track.Sessions) - { -
- @session.Title - @EventDateHelper.GetTimeRangeText(TimeOnly.FromDateTime(session.StartTime), TimeOnly.FromDateTime(session.EndTime)) | @session.Language - @foreach (var speaker in session.Speakers) - { - @speaker.UserName - } - - Edit +
+ @foreach (var session in track.Sessions) + { +
+ @session.Title + @EventDateHelper.GetTimeRangeText(TimeOnly.FromDateTime(session.StartTime), TimeOnly.FromDateTime(session.EndTime)) | @session.Language + @foreach (var speaker in session.Speakers) + { + @speaker.UserName + } + + Edit + +
+ } + - } - -
@@ -52,7 +75,10 @@ -}else + + + + + + +} +else { - + } diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml index 6b894ef..f7eef3d 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml @@ -1,4 +1,5 @@ @using EventHub.Web.Pages.Events.Components.CreateEventArea +@using EventHub.Events @model List @@ -15,7 +16,7 @@ {
- @track.Name + @track.Name Edit @@ -61,7 +62,7 @@
@@ -88,7 +89,7 @@
diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml index 45ced9d..fe36e60 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml @@ -1,11 +1,16 @@ +@using EventHub.Web @using EventHub.Web.Pages.Events.Components.CreateEventArea @using Microsoft.AspNetCore.Http +@using Microsoft.Extensions.Options @model EventHub.Web.Pages.Events.Components.CreateEventArea.CreateEventAreaViewComponent.NewEventViewModel +@inject IOptions UrlOptions @{ var organizations = new List(); var countries = new List(); var languages = new List(); + var eventId = ViewData["EventId"] as Guid?; + @if (ViewData["StepType"]!.ToString() == CreateEventAreaViewComponent.ProgressStepType.NewEvent.ToString()) { organizations = ViewData["Organizations"] as List; @@ -82,7 +87,14 @@

Cover Image

-
+ @if (eventId.HasValue) + { +
+ } + else + { +
+ }
@@ -136,7 +148,8 @@
-
diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml index 208d046..4452114 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml @@ -1,13 +1,19 @@ +@using EventHub.Web @using EventHub.Web.Pages.Events @using EventHub.Web.Pages.Events.Components.CreateEventArea @using Microsoft.AspNetCore.Http +@using Microsoft.Extensions.Options @model EventHub.Web.Pages.Events.Components.CreateEventArea.CreateEventAreaViewComponent.NewEventViewModel +@inject IOptions UrlOptions @{ var organizationName = ""; var countryName = ""; + Guid? eventId = null; @if (ViewData["StepType"]!.ToString() == CreateEventAreaViewComponent.ProgressStepType.Preview.ToString()) { + eventId = ViewData["EventId"] as Guid?; + organizationName = ViewData["OrganizationName"] as string; if (organizationName.IsNullOrWhiteSpace()) { @@ -74,7 +80,7 @@ Cover Image:
- +
@if (Model.IsOnline != null && Model.IsOnline!.Value) diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js index b14c15f..cca2eab 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js @@ -1,5 +1,6 @@ (function () { abp.widgets.CreateEventArea = function ($wrapper) { + var l = abp.localization.getResource('EventHub'); toastr.options.timeOut = 500; toastr.options.preventDuplicates = true; @@ -28,7 +29,9 @@ $('#CreateEventButton').removeAttr('disabled') FocusTrackNameInputInModalEventHandler("AddTrackModal") FocusTrackNameInputInModalEventHandler("EditTrackModal") - + NewEventFormInputAreaChangeHandler(); + FilFileInputChangeEventHandler(); + if (eventIdInput.val().length === 36) { // TODO: Add organization in UppdateEventDto $('#OrganizationId').prop("disabled", true).removeAttr('name'); @@ -39,21 +42,46 @@ if (!$(this).valid()) { return false; } - var input = $(this).serializeFormToObject(); + + var formData = new FormData(); + formData = FillNewEventFormData(formData); + var httpMetod = 'POST' if (eventIdInput.val().length === 36) { - eventApiService.update(eventIdInput.val(), input).then(function () { - abp.notify.success('Updated event'); - SwitchToTrackCreation() - }); - } else { - eventApiService.create(input).then(function (eventCreatedResponse) { - abp.notify.success('Created event as a draft'); - eventIdInput.val(eventCreatedResponse.id); - eventUrlCodeInput.val(eventCreatedResponse.urlCode); - SwitchToTrackCreation() - }); + httpMetod = 'PUT' } + + $.ajax({ + xhr: function() { + var xhr = new window.XMLHttpRequest(); + xhr.upload.addEventListener("progress", function(evt) { + if (evt.lengthComputable) { + var percentComplete = evt.loaded / evt.total; + percentComplete = parseInt(percentComplete * 100); + if(percentComplete !== 100){ + $('#CreateEventButton').prop( "disabled", true); + } + } + }, false); + + return xhr; + }, + url: $('#CreateEventButton').data('url'), + data: formData, + type: httpMetod, + contentType: false, + processData: false, + success: function(response){ + if (eventIdInput.val().length === 36) { + abp.notify.success('Updated event'); + }else{ + abp.notify.success('Created event as a draft'); + eventIdInput.val(response.id); + eventUrlCodeInput.val(response.urlCode); + } + SwitchToTrackCreation() + } + }); }); function SwitchToTrackCreation() { @@ -61,7 +89,7 @@ $('#CreateTrackContainer').css('display', ''); ScrollToWrapperBegin(); } - + AddNewTrackSubmitFormEventHandler(); OpenEditTrackModalClickEventHandler(); EditTrackSubmitFormEventHandler(); @@ -75,6 +103,23 @@ PrevieousOrNextStepTransitionEventHandler() }; + + function FillNewEventFormData(formData) { + var fileInput = document.getElementById('Event_CoverImageFile'); + formData.append("OrganizationId", $('#OrganizationId').val().trim()); + formData.append("Title", $('#inputTitle').val().trim()); + formData.append("StartTime", $('#inputStartdate').val().trim()); + formData.append("EndTime", $('#inputEnddate').val().trim()); + formData.append("Description", $('#inputDescription').val().trim()); + formData.append("CoverImageStreamContent", fileInput.files[0]); + formData.append("IsOnline", $('#IsOnline').val().trim()); + formData.append("OnlineLink", $('#inputOnlineLink').val().trim()); + formData.append("CountryId", $('#CountryId').val().trim()); + formData.append("City", $('#inputCity').val().trim()); + formData.append("Language", $('#Language').val().trim()); + formData.append("Capacity", $('#inputCapacity').val().trim()); + return formData; + } function AddNewTrackSubmitFormEventHandler() { var addNewTrackForm = $('#AddNewTrackForm'); @@ -328,6 +373,101 @@ $('button[type=submit]').removeAttr('disabled') } } + + function NewEventFormInputAreaChangeHandler() { + var isOnline = $("#IsOnline option:selected").val() + if (isOnline === "True") { + $(".event-link-group").show(); + $(".event-location-group").hide(); + } else { + $(".event-link-group").hide(); + $(".event-location-group").show(); + } + + $('#IsOnline').on('change', '', function () { + var isOnline = $("#IsOnline option:selected").val() + if (isOnline === "True") { + $("#CountryId").attr("required", false); + $("#inputCity").attr("required", false); + $(".event-link-group").show(); + $(".event-location-group").hide(); + } else { + $("#CountryId").attr("required", true); + $("#inputCity").attr("required", true); + $(".event-link-group").hide(); + $(".event-location-group").show(); + } + }); + } + + function FilFileInputChangeEventHandler() { + var file; + var infoArea = document.getElementById('upload-label'); + var fileInput = document.getElementById('Event_CoverImageFile'); + + if (fileInput !== null) { + fileInput.addEventListener('change', function () { + var showFile = true; + + file = fileInput.files[0]; + + if (file === undefined) { + $('#Event_CoverImageFile').val(''); + $('#imageResult').attr('src', '#'); + infoArea.textContent = 'Choose file' + return; + } + + var permittedExtensions = ["jpg", "jpeg", "png"] + var fileExtension = $(this).val().split('.').pop(); + if (permittedExtensions.indexOf(fileExtension) === -1) { + showFile = false; + abp.message.error(l('EventCoverImageExtensionNotAllowed')) + .then(() => { + $('#Event_CoverImageFile').val(''); + file = null; + }); + } else if (file.size > 1024 * 1024) { + showFile = false; + abp.message.error(l('EventCoverImageSizeExceedMessage')) + .then(() => { + $('#Event_CoverImageFile').val(''); + file = null; + }); + } + + var img = new Image(); + img.onload = function () { + var imageError = true; + var sizes = { + width: this.width, + height: this.height + }; + URL.revokeObjectURL(this.src); + + if (showFile && imageError) { + readURL(file); + } + } + + var objectURL = URL.createObjectURL(file); + img.src = objectURL; + }); + + function readURL(input) { + if (input) { + var reader = new FileReader(); + + reader.onload = function (e) { + $('#imageResult').attr('src', e.target.result); + infoArea.textContent = 'File name: ' + input.name; + } + + reader.readAsDataURL(input); + } + } + } + } return { getFilters: getFilters, diff --git a/src/EventHub.Web/Pages/Events/New.js b/src/EventHub.Web/Pages/Events/New.js index cbb895e..e69de29 100644 --- a/src/EventHub.Web/Pages/Events/New.js +++ b/src/EventHub.Web/Pages/Events/New.js @@ -1,94 +0,0 @@ -$(function () { - var l = abp.localization.getResource('EventHub'); - - var isOnline = $("#Event_IsOnline option:selected").val() - if (isOnline === "True") { - $(".event-link-group").show(); - $(".event-location-group").hide(); - } else { - $(".event-link-group").hide(); - $(".event-location-group").show(); - } - - $('#Event_IsOnline').on('change', '', function () { - var isOnline = $("#Event_IsOnline option:selected").val() - if (isOnline === "True") { - $("#Event_CountryId").attr("required", false); - $("#inputCity").attr("required", false); - $(".event-link-group").show(); - $(".event-location-group").hide(); - } else { - $("#Event_CountryId").attr("required", true); - $("#inputCity").attr("required", true); - $(".event-link-group").hide(); - $(".event-location-group").show(); - } - }); - - var infoArea = document.getElementById('upload-label'); - var fileInput = document.getElementById('Event_CoverImageFile'); - var file; - - if (fileInput !== null) { - fileInput.addEventListener('change', function () { - var showFile = true; - - file = fileInput.files[0]; - - if (file === undefined) { - $('#Event_CoverImageFile').val(''); - $('#imageResult').attr('src', '#'); - infoArea.textContent = 'Choose file' - return; - } - - var permittedExtensions = ["jpg", "jpeg", "png"] - var fileExtension = $(this).val().split('.').pop(); - if (permittedExtensions.indexOf(fileExtension) === -1) { - showFile = false; - abp.message.error(l('EventCoverImageExtensionNotAllowed')) - .then(() => { - $('#Event_CoverImageFile').val(''); - file = null; - }); - } else if (file.size > 1024 * 1024) { - showFile = false; - abp.message.error(l('EventCoverImageSizeExceedMessage')) - .then(() => { - $('#Event_CoverImageFile').val(''); - file = null; - }); - } - - var img = new Image(); - img.onload = function () { - var imageError = true; - var sizes = { - width: this.width, - height: this.height - }; - URL.revokeObjectURL(this.src); - - if (showFile && imageError) { - readURL(file); - } - } - - var objectURL = URL.createObjectURL(file); - img.src = objectURL; - }); - - function readURL(input) { - if (input) { - var reader = new FileReader(); - - reader.onload = function (e) { - $('#imageResult').attr('src', e.target.result); - infoArea.textContent = 'File name: ' + input.name; - } - - reader.readAsDataURL(input); - } - } - } -}); \ No newline at end of file From 4e65b8997515fab29687b2b38bbc021c7611d236 Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Fri, 17 Dec 2021 11:54:12 +0300 Subject: [PATCH 26/44] Update _previewSection.cshtml --- .../CreateEventArea/_previewSection.cshtml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml index 4452114..177e33d 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml @@ -191,9 +191,9 @@ } else { -
- There is no session! - Please add session. +
+ There is no session! + Please add session.
} @@ -206,7 +206,14 @@ diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js index cca2eab..7c17caa 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js @@ -33,8 +33,7 @@ FilFileInputChangeEventHandler(); if (eventIdInput.val().length === 36) { - // TODO: Add organization in UppdateEventDto - $('#OrganizationId').prop("disabled", true).removeAttr('name'); + $('#OrganizationId').prop("disabled", true); // Once the Organization is selected, it cannot be changed again. } $("#CreateEventForm").submit(function (e) { @@ -75,9 +74,9 @@ if (eventIdInput.val().length === 36) { abp.notify.success('Updated event'); }else{ - abp.notify.success('Created event as a draft'); + abp.notify.success('Created event as a draft' , '', toastr.options.timeOut = 2500); eventIdInput.val(response.id); - eventUrlCodeInput.val(response.urlCode); + eventUrlCodeInput.val(response.urlCode); } SwitchToTrackCreation() } @@ -101,6 +100,8 @@ EditSessionEventHandler(); DeleteSessionButtonClickEventHandler(); + PublishEventButtonClickEventHandler(); + PrevieousOrNextStepTransitionEventHandler() }; @@ -179,6 +180,7 @@ function DeleteTrackButtonClickEventHandler() { $('.delete-track-button').click(function (e) { + e.preventDefault(); eventApiService.deleteTrack(eventIdInput.val(), this.id).then(function () { abp.notify.success('Successfully deleted'); FillFilter(stepType.NewTrack) @@ -224,6 +226,7 @@ function OpenEditSessionModalClickEventHandler() { $('.edit-session-button').click(function (e) { + e.preventDefault(); var editSessionModal = $('#EditSessionModal'); var clickedSessionId = this.id; @@ -269,6 +272,7 @@ function DeleteSessionButtonClickEventHandler() { $('.delete-session-button').click(function (e) { + e.preventDefault(); var clickedSessionId = this.id; var trackId = $('#' + clickedSessionId).data('track-id'); @@ -280,6 +284,17 @@ }); } + function PublishEventButtonClickEventHandler() { + $('#PublishButton').click(function (e) { + e.preventDefault(); + eventApiService.publish(eventIdInput.val()).then(function (res) { + e.prefe + abp.notify.success('Event Published'); + window.location.replace('https://' + window.location.host + '/events/' + res); + }); + }); + } + function PrevieousOrNextStepTransitionEventHandler() { $('.step-transition').click(function (e) { var clickedButtonId = this.id; diff --git a/src/EventHub.Web/Pages/Events/New.cshtml b/src/EventHub.Web/Pages/Events/New.cshtml index 565d962..445b4a8 100644 --- a/src/EventHub.Web/Pages/Events/New.cshtml +++ b/src/EventHub.Web/Pages/Events/New.cshtml @@ -6,10 +6,7 @@ @model EventHub.Web.Pages.Events.NewPageModel @section scripts { - - - - + } @section styles { diff --git a/src/EventHub.Web/Pages/Events/New.js b/src/EventHub.Web/Pages/Events/New.js deleted file mode 100644 index e69de29..0000000 From d6e1237b82da608129d3016c69209c2058fbddcc Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Fri, 17 Dec 2021 14:04:17 +0300 Subject: [PATCH 29/44] Delete empty page --- src/EventHub.Web/Pages/Empty.cshtml | 853 ------------------------- src/EventHub.Web/Pages/Empty.cshtml.cs | 10 - 2 files changed, 863 deletions(-) delete mode 100644 src/EventHub.Web/Pages/Empty.cshtml delete mode 100644 src/EventHub.Web/Pages/Empty.cshtml.cs diff --git a/src/EventHub.Web/Pages/Empty.cshtml b/src/EventHub.Web/Pages/Empty.cshtml deleted file mode 100644 index 491dd0e..0000000 --- a/src/EventHub.Web/Pages/Empty.cshtml +++ /dev/null @@ -1,853 +0,0 @@ -@page "/test" -@using EventHub.Web.Pages -@model EventHub.Web.Pages.Empty - @* TODO(berkansasmaz): Delete this page *@ -
-

Create an Event

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ut nulla consequat, tempus sapien in, - pellentesque nunc. Sed at nunc pellentesque, fermentum mi et, fermentum massa.

-
-
-
-
- - - - - - - -

Create a New Event

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam utnulla consequat, tempus sapien in.

- Create -
-
-
-
-
-
- - - - - - -

Drafts

-
-
- -
- Last edit: 01/01/2020 -
-
-
-
-
- -
- Last edit: 01/01/2020 -
-
-
-
-
- -
- Last edit: 01/01/2020 -
-
-
-
-
- -
- Last edit: 01/01/2020 -
-
-
-
-
-
-
- - -
-
-
    -
  • 1New Event
  • -
  • 2Add Track
  • -
  • 3Add Session
  • -
-
-
-
-
-
- - -
-
-
-
-

Create a New Event

-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
- -
-
-

Cover Image

-
-
-
- -
-
-
-
-

Photo size should be 1050x596 and max 5 MB.

- - - -
-
-
-
-
- -
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
- -
-
- -
-
-
-
-
- - -
-
-
    -
  • 1New Event
  • -
  • 2Add Track
  • -
  • 3Add Session
  • -
-
-
-
-
-
- - -
-
-
-
-

Add Track

-
-
-
- There is a track name here - Edit -
-
-
-
- There is a track name here - Edit -
-
-
-
- There is a track name here - Edit -
-
-
- -
-
-
- - -
-
-
- - -
-
-
    -
  • 1New Event
  • -
  • 2Add Track
  • -
  • 3Add Session
  • -
-
-
-
-
-
- - -
-
-
-
-

Add Session

- - - - - - - - - - - - - - - - - - -
Track 1Track 1Track 1Track 1
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan - Edit -
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan - Edit -
- -
- - -
- Session Title - 09:00 - 10:00 | English - Berkan Şaşmaz - Edit -
- -
- -
-
- -
-
-
- - -
-
-
-
-

Event Preview

-
-
- Organization Name: -
-
- Volosoft -
-
-
-
- Title: -
-
- My pretty cool event -
-
-
-
- Start Date: -
-
- 10/08/2025 - 09:00 -
-
-
-
- End Date: -
-
- 10/08/2025 - 10:00 -
-
-
-
- Event’s Explanation: -
-
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea - commodo consequat. Duis aute irure dolor in reprehenderit in voluptate - velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat - cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id - est laborum.

-
-
-
-
- Cover Image: -
-
- -
-
-
-
- Country: -
-
- Turkey -
-
-
-
- City: -
-
- Istanbul -
-
-
-
- Language: -
-
- English -
-
-
-
- Capacity: -
-
- 100+ -
-
-
-
- Event Type: -
-
- Online -
-
-
-
- Tracks: -
-
- 4 -
-
-
-
- Sessions: -
-
- - - - - - - - - - - - - - - - - - - -
Track 1Track 1Track 1Track 1
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
- Session Title - 09:00 - 10:00 | English - Halil İbrahim Kalkan -
-
-
- -
-
-
-
- - - - - - - - - - - - - - - -
-

Eventhub Pricing List

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ut nulla consequat, tempus sapien in, - pellentesque nunc. Sed at nunc pellentesque, fermentum mi et, fermentum massa.

-
-
-
-
-

Normal Account

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam utnulla consequat, tempus sapien in.

-
- $ - 0 -
-
    -
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • -
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • -
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • -
-
-
-
-
-
-
-

Premium Account

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam utnulla consequat, tempus sapien in.

-
- $ - 60 -
-
    -
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • -
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • -
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit adipiscing elit.
  • -
  • Lorem ipsum adipiscing elit dolor sit amet, consectetur adipiscing elit.
  • -
  • Lorem adipiscing elit adipiscing elitipsum dolor sit amet, consectetur adipiscing elit.
  • -
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • -
- Upgrade to Premium -
-
-
- -

Frequently Asked Questions

- -
-
-
-
-
-
-
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit. -

-
-
-
-
-
-
-
-
-
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit. -

-
-
-
-
-
-
-
-
-
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. -

-
-
-
-
-
-
-
-
-
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit. -

-
-
-
-
-
-
- - -
-

Title Cart

-
-
-
-
-

Product Detail

-

Premium Account: Volosoft Company

-

Start Date: 02/11/2020

-

End Date: 02/11/2020

-
-
-
-
-
-
-

Summary

-
-

Premium Licence 02/11/2020

-
-

TOTAL 02/11/2020

-
- Checkout -
-
-
-
-
- - - diff --git a/src/EventHub.Web/Pages/Empty.cshtml.cs b/src/EventHub.Web/Pages/Empty.cshtml.cs deleted file mode 100644 index 8c3ad89..0000000 --- a/src/EventHub.Web/Pages/Empty.cshtml.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace EventHub.Web.Pages -{ - public class Empty : EventHubPageModel - { - public void OnGet() - { - - } - } -} \ No newline at end of file From 273d41775b3eb6ceb326252a24efd1db84cf163b Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Fri, 17 Dec 2021 15:22:15 +0300 Subject: [PATCH 30/44] refactor event track and session system --- .../Localization/EventHub/en.json | 2 +- .../CreateEventArea/_addSessionSection.cshtml | 4 +- .../CreateEventArea/_newEventSection.cshtml | 4 +- .../CreateEventArea/_previewSection.cshtml | 2 +- .../CreateEventArea/create-event-area.js | 19 +++- src/EventHub.Web/Pages/Events/Detail.cshtml | 78 +++++++++++++-- src/EventHub.Web/wwwroot/global-styles.css | 94 +++++++++++++------ 7 files changed, 156 insertions(+), 47 deletions(-) diff --git a/src/EventHub.Domain.Shared/Localization/EventHub/en.json b/src/EventHub.Domain.Shared/Localization/EventHub/en.json index dcf7d34..b3f9de7 100644 --- a/src/EventHub.Domain.Shared/Localization/EventHub/en.json +++ b/src/EventHub.Domain.Shared/Localization/EventHub/en.json @@ -18,7 +18,7 @@ "DisplayName:Capacity": "Capacity", "EventHub:OrganizationNameAlreadyExists": "The organization {Name} already exists. Please use another name.", "EventHub:NotAuthorizedToCreateEventInThisOrganization": "You are not authorized to create events for the organization {0}.", - "EventHub:EventEndTimeCantBeEarlierThanStartTime": "Event end time can not be earlier than the start time.", + "EventHub:EndTimeCantBeEarlierThanStartTime": "Event end time can not be earlier than the start time.", "EventHub:CantRegisterOrUnregisterForAPastEvent": "Can not register to or unregister from an event in the past.", "Events": "Events", "Members": "Members", diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml index f486dd8..ff49bc8 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml @@ -66,12 +66,12 @@ @speaker.UserName } - + Edit - + Delete diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml index fe36e60..5b973bd 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml @@ -89,12 +89,14 @@
@if (eventId.HasValue) { -
+
+ } else {
} +
diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml index 0fd2bca..6c66c06 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_previewSection.cshtml @@ -193,7 +193,7 @@ {
There is no session! - Please add session. + Tracks without Session are not visible after the event is published.
} diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js index 7c17caa..92e98e5 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js @@ -79,6 +79,15 @@ eventUrlCodeInput.val(response.urlCode); } SwitchToTrackCreation() + }, + error: function (errorRaw) { + abp.notify.error(errorRaw.responseJSON.error.message, 'Error', + toastr.options = { + timeOut: 2500, + progressBar: true, + positionClass: "toast-bottom-right" + } + ); } }); }); @@ -392,9 +401,13 @@ function NewEventFormInputAreaChangeHandler() { var isOnline = $("#IsOnline option:selected").val() if (isOnline === "True") { + $("#CountryId").attr("required", false); + $("#inputCity").attr("required", false); $(".event-link-group").show(); $(".event-location-group").hide(); } else { + $("#CountryId").attr("required", true); + $("#inputCity").attr("required", true); $(".event-link-group").hide(); $(".event-location-group").show(); } @@ -464,7 +477,7 @@ readURL(file); } } - + var objectURL = URL.createObjectURL(file); img.src = objectURL; }); @@ -474,6 +487,10 @@ var reader = new FileReader(); reader.onload = function (e) { + if (eventIdInput.val().length === 36){ + $('.image-area').css('display', 'none').removeClass('d-block'); + $('.result-area').css('display', ''); + } $('#imageResult').attr('src', e.target.result); infoArea.textContent = 'File name: ' + input.name; } diff --git a/src/EventHub.Web/Pages/Events/Detail.cshtml b/src/EventHub.Web/Pages/Events/Detail.cshtml index 11faeaf..ba16075 100644 --- a/src/EventHub.Web/Pages/Events/Detail.cshtml +++ b/src/EventHub.Web/Pages/Events/Detail.cshtml @@ -73,16 +73,74 @@
-
Event Description
-

- @Model.Event.Description -

+ @if (Model.Event.Tracks.Any()) + { + + +
Event Description
+

+ @Model.Event.Description +

+ +
Date
+

+ @EventDateHelper.GetDateRangeText(Model.Event.StartTime, Model.Event.EndTime) +

+ @await Component.InvokeAsync(typeof(AttendeesAreaViewComponent), new { eventId = Model.Event.Id }) +
+ + + + + @foreach (var track in Model.Event.Tracks) + { + @if (track.Sessions.Any()) + { + + } + } + + + + + @foreach (var track in Model.Event.Tracks) + { + @if (track.Sessions.Any()) + { + + } + } + + +
@track.Name
+ @foreach (var session in track.Sessions) + { +
+ @session.Title.TruncateWithPostfix(25) + @EventDateHelper.GetTimeRangeText(TimeOnly.FromDateTime(session.StartTime), TimeOnly.FromDateTime(session.EndTime)) | @session.Language + @foreach (var speaker in session.Speakers) + { + @speaker.UserName + } +
+ } +
+
+
+ } + else + { +
Event Description
+

+ @Model.Event.Description +

-
Date
-

- @EventDateHelper.GetDateRangeText(Model.Event.StartTime, Model.Event.EndTime) -

- @await Component.InvokeAsync(typeof(AttendeesAreaViewComponent), new {eventId = Model.Event.Id}) +
Date
+

+ @EventDateHelper.GetDateRangeText(Model.Event.StartTime, Model.Event.EndTime) +

+ @await Component.InvokeAsync(typeof(AttendeesAreaViewComponent), new { eventId = Model.Event.Id }) + }
@@ -102,4 +160,4 @@ MaxResultCount = 6, isPagination = false }) -
\ No newline at end of file +
diff --git a/src/EventHub.Web/wwwroot/global-styles.css b/src/EventHub.Web/wwwroot/global-styles.css index 35c9044..24507b7 100644 --- a/src/EventHub.Web/wwwroot/global-styles.css +++ b/src/EventHub.Web/wwwroot/global-styles.css @@ -3,8 +3,9 @@ .border-light { border-color: #E1E5E9 !important; } -.text-info { - color: #6F32E2!important; + +.text-info { + color: #6F32E2 !important; } @@ -34,8 +35,8 @@ .progresses ul li.create-steps.blue { color: #fff; - background-color: #00044A; - border-color: #00044A; + background-color: #00044A; + border-color: #00044A; } .progresses ul li.create-steps span { @@ -44,12 +45,12 @@ left: -30px; font-size: 0.8rem; width: 90px; - color:#bfc6cd; -} + color: #bfc6cd; +} -.progresses ul li.create-steps.blue span { - color:#00044A; -} +.progresses ul li.create-steps.blue span { + color: #00044A; +} .progresses .progress { height: 2px; @@ -59,64 +60,73 @@ background-color: #DCE0E5; border-radius: 10px } -.progress-bar { - background-color: #00044A; + +.progress-bar { + background-color: #00044A; } -.nav-pills .nav-link.active, .nav-pills .show > .nav-link { +.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background-color: #00044A !important; } -.big-square-btn .btn { +.big-square-btn .btn { border: 1px solid rgba(107, 126, 146, 0.20); min-height: 177px; background: rgba(107, 126, 146, 0.05); } -.big-square-btn .btn:hover { + +.big-square-btn .btn:hover { color: #E8345D; background: #fff; } -.big-square-btn .fa-plus { - border: 2px dashed; + +.big-square-btn .fa-plus { + border: 2px dashed; width: 34px; height: 34px; border-radius: 34px; line-height: 30px; } -.track-item { +.track-item { border: 1px solid rgba(107, 126, 146, 0.20); padding: 1.5em; border-radius: 10px; min-height: 177px; margin-bottom: 1em; } -.track-item .track-name{ + +.track-item .track-name { font-weight: 500; font-size: 1.125em; color: #03044a; } + .table > :not(:first-child) { border-top: 1px solid currentColor; -} -.table td, .table th { +} + +.table td, .table th { font-weight: normal; padding: 16px 8px; color: #6B7E92; } + .text-primary { color: #E8345D !important; -} +} + .preview-item { color: #00044A; } -.price small{ +.price small { font-size: 20px; color: #00044A; font-weight: 800; } -.price span{ + +.price span { font-size: 60px; color: #00044A; font-weight: 800; @@ -127,11 +137,13 @@ padding: 0; margin: 0 30px 0 40px; } -.list-check-icon li{ + +.list-check-icon li { margin: 1em 2em; } + .list-check-icon .fa { - color:#E8345D; + color: #E8345D; margin: 0 10px 0 -28px; } @@ -140,16 +152,19 @@ border-color: #6F32E2; color: white; } + .btn-info:hover { background: #662ad6; border-color: #662ad6; color: white; } + .btn-check:focus + .btn-info, .btn-info:focus { background: #662ad6; border-color: #662ad6; color: white; } + .faq.shown { background-color: #fff9f7; } @@ -167,17 +182,17 @@ } .faq-container .faq button.btn.btn-faq.collapsed { - + } -.faq-container .faq button.btn.btn-faq .fas{ +.faq-container .faq button.btn.btn-faq .fas { position: absolute; top: 15px; left: 0px; } -.faq-container .faq button.btn.btn-faq.collapsed .fas{ - color:#E8345D; +.faq-container .faq button.btn.btn-faq.collapsed .fas { + color: #E8345D; transform: rotate(180deg); } @@ -196,14 +211,15 @@ padding: 15px 0 10px 0; } -.btn-check:focus + .btn, .btn:focus { +.btn-check:focus + .btn, .btn:focus { box-shadow: none; } .text-dark { font-weight: 700; color: #03044a !important; -} +} + .modal-icon { display: block; font-size: 64px; @@ -211,6 +227,7 @@ margin-bottom: 30px; color: #6F32E2; } + .rounded-3 { border-radius: 1rem !important; } @@ -222,3 +239,18 @@ overflow: hidden; width: 140px; } +.nav-tabs .nav-link { + width: 217px !important; + left: 452px !important; + top: 567px !important; + border-radius: unset !important; + font-size: 20px !important; + line-height: 24px !important; + color: #6B7E92 !important; +} + +.nav-tabs .active, .btn:hover { + color: #00044A !important; + border: unset !important; +} + From aa4ae53276b370b878071d6bd5749de15183b0ac Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Fri, 17 Dec 2021 15:31:00 +0300 Subject: [PATCH 31/44] Use IGuidGenerator for Country data seeder --- .../Data/EventHubDataSeedContributor.cs | 401 +++++++++--------- 1 file changed, 202 insertions(+), 199 deletions(-) diff --git a/src/EventHub.Domain/Data/EventHubDataSeedContributor.cs b/src/EventHub.Domain/Data/EventHubDataSeedContributor.cs index b58a6e5..0ce6c03 100644 --- a/src/EventHub.Domain/Data/EventHubDataSeedContributor.cs +++ b/src/EventHub.Domain/Data/EventHubDataSeedContributor.cs @@ -5,17 +5,21 @@ using EventHub.Countries; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories; +using Volo.Abp.Guids; namespace EventHub.Data { public class EventHubDataSeedContributor : IDataSeedContributor, ITransientDependency { private readonly IRepository _countryRepository; - + private readonly IGuidGenerator _guidGenerator; + public EventHubDataSeedContributor( - IRepository countryRepository) + IRepository countryRepository, + IGuidGenerator guidGenerator) { _countryRepository = countryRepository; + _guidGenerator = guidGenerator; } public async Task SeedAsync(DataSeedContext context) @@ -32,205 +36,204 @@ namespace EventHub.Data var countries = new List { - //TODO: Use IGuidGenerator - new Country(Guid.NewGuid(), "Afghanistan"), - new Country(Guid.NewGuid(), "Albania"), - new Country(Guid.NewGuid(), "Algeria"), - new Country(Guid.NewGuid(), "Andorra"), - new Country(Guid.NewGuid(), "Angola"), - new Country(Guid.NewGuid(), "Antigua and Barbuda"), - new Country(Guid.NewGuid(), "Argentina"), - new Country(Guid.NewGuid(), "Armenia"), - new Country(Guid.NewGuid(), "Australia"), - new Country(Guid.NewGuid(), "Austria"), - new Country(Guid.NewGuid(), "Azerbaijan"), - new Country(Guid.NewGuid(), "Bahamas"), - new Country(Guid.NewGuid(), "Bahrain"), - new Country(Guid.NewGuid(), "Bangladesh"), - new Country(Guid.NewGuid(), "Barbados"), - new Country(Guid.NewGuid(), "Belarus"), - new Country(Guid.NewGuid(), "Belgium"), - new Country(Guid.NewGuid(), "Belize"), - new Country(Guid.NewGuid(), "Benin"), - new Country(Guid.NewGuid(), "Bhutan"), - new Country(Guid.NewGuid(), "Bolivia"), - new Country(Guid.NewGuid(), "Bosnia and Herzegovina"), - new Country(Guid.NewGuid(), "Botswana"), - new Country(Guid.NewGuid(), "Brazil"), - new Country(Guid.NewGuid(), "Brunei"), - new Country(Guid.NewGuid(), "Bulgaria"), - new Country(Guid.NewGuid(), "Burkina Faso"), - new Country(Guid.NewGuid(), "Burundi"), - new Country(Guid.NewGuid(), "Côte d'Ivoire"), - new Country(Guid.NewGuid(), "Cabo Verde"), - new Country(Guid.NewGuid(), "Cambodia"), - new Country(Guid.NewGuid(), "Cameroon"), - new Country(Guid.NewGuid(), "Canada"), - new Country(Guid.NewGuid(), "Central African Republic"), - new Country(Guid.NewGuid(), "Chad"), - new Country(Guid.NewGuid(), "Chile"), - new Country(Guid.NewGuid(), "China"), - new Country(Guid.NewGuid(), "Colombia"), - new Country(Guid.NewGuid(), "Comoros"), - new Country(Guid.NewGuid(), "Congo (Congo-Brazzaville)"), - new Country(Guid.NewGuid(), "Costa Rica"), - new Country(Guid.NewGuid(), "Croatia"), - new Country(Guid.NewGuid(), "Cuba"), - new Country(Guid.NewGuid(), "Cyprus"), - new Country(Guid.NewGuid(), "Czechia (Czech Republic)"), - new Country(Guid.NewGuid(), "Democratic Republic of the Congo"), - new Country(Guid.NewGuid(), "Denmark"), - new Country(Guid.NewGuid(), "Djibouti"), - new Country(Guid.NewGuid(), "Dominica"), - new Country(Guid.NewGuid(), "Dominican Republic"), - new Country(Guid.NewGuid(), "Ecuador"), - new Country(Guid.NewGuid(), "Egypt"), - new Country(Guid.NewGuid(), "El Salvador"), - new Country(Guid.NewGuid(), "Equatorial Guinea"), - new Country(Guid.NewGuid(), "Eritrea"), - new Country(Guid.NewGuid(), "Estonia"), - new Country(Guid.NewGuid(), "Eswatini (formerly Swaziland)"), - new Country(Guid.NewGuid(), "Ethiopia"), - new Country(Guid.NewGuid(), "Fiji"), - new Country(Guid.NewGuid(), "Finland"), - new Country(Guid.NewGuid(), "France"), - new Country(Guid.NewGuid(), "Gabon"), - new Country(Guid.NewGuid(), "Gambia"), - new Country(Guid.NewGuid(), "Georgia"), - new Country(Guid.NewGuid(), "Germany"), - new Country(Guid.NewGuid(), "Ghana"), - new Country(Guid.NewGuid(), "Greece"), - new Country(Guid.NewGuid(), "Grenada"), - new Country(Guid.NewGuid(), "Guatemala"), - new Country(Guid.NewGuid(), "Guinea"), - new Country(Guid.NewGuid(), "Guinea-Bissau"), - new Country(Guid.NewGuid(), "Guyana"), - new Country(Guid.NewGuid(), "Haiti"), - new Country(Guid.NewGuid(), "Holy See"), - new Country(Guid.NewGuid(), "Honduras"), - new Country(Guid.NewGuid(), "Hungary"), - new Country(Guid.NewGuid(), "Iceland"), - new Country(Guid.NewGuid(), "India"), - new Country(Guid.NewGuid(), "Indonesia"), - new Country(Guid.NewGuid(), "Iran"), - new Country(Guid.NewGuid(), "Iraq"), - new Country(Guid.NewGuid(), "Ireland"), - new Country(Guid.NewGuid(), "Israel"), - new Country(Guid.NewGuid(), "Italy"), - new Country(Guid.NewGuid(), "Jamaica"), - new Country(Guid.NewGuid(), "Japan"), - new Country(Guid.NewGuid(), "Jordan"), - new Country(Guid.NewGuid(), "Kazakhstan"), - new Country(Guid.NewGuid(), "Kenya"), - new Country(Guid.NewGuid(), "Kiribati"), - new Country(Guid.NewGuid(), "Kuwait"), - new Country(Guid.NewGuid(), "Kyrgyzstan"), - new Country(Guid.NewGuid(), "Laos"), - new Country(Guid.NewGuid(), "Latvia"), - new Country(Guid.NewGuid(), "Lebanon"), - new Country(Guid.NewGuid(), "Lesotho"), - new Country(Guid.NewGuid(), "Liberia"), - new Country(Guid.NewGuid(), "Libya"), - new Country(Guid.NewGuid(), "Liechtenstein"), - new Country(Guid.NewGuid(), "Lithuania"), - new Country(Guid.NewGuid(), "Luxembourg"), - new Country(Guid.NewGuid(), "Madagascar"), - new Country(Guid.NewGuid(), "Malawi"), - new Country(Guid.NewGuid(), "Malaysia"), - new Country(Guid.NewGuid(), "Maldives"), - new Country(Guid.NewGuid(), "Mali"), - new Country(Guid.NewGuid(), "Malta"), - new Country(Guid.NewGuid(), "Marshall Islands"), - new Country(Guid.NewGuid(), "Mauritania"), - new Country(Guid.NewGuid(), "Mauritius"), - new Country(Guid.NewGuid(), "Mexico"), - new Country(Guid.NewGuid(), "Micronesia"), - new Country(Guid.NewGuid(), "Moldova"), - new Country(Guid.NewGuid(), "Monaco"), - new Country(Guid.NewGuid(), "Mongolia"), - new Country(Guid.NewGuid(), "Montenegro"), - new Country(Guid.NewGuid(), "Morocco"), - new Country(Guid.NewGuid(), "Mozambique"), - new Country(Guid.NewGuid(), "Myanmar (formerly Burma)"), - new Country(Guid.NewGuid(), "Namibia"), - new Country(Guid.NewGuid(), "Nauru"), - new Country(Guid.NewGuid(), "Nepal"), - new Country(Guid.NewGuid(), "Netherlands"), - new Country(Guid.NewGuid(), "New Zealand"), - new Country(Guid.NewGuid(), "Nicaragua"), - new Country(Guid.NewGuid(), "Niger"), - new Country(Guid.NewGuid(), "Nigeria"), - new Country(Guid.NewGuid(), "North Korea"), - new Country(Guid.NewGuid(), "North Macedonia"), - new Country(Guid.NewGuid(), "Norway"), - new Country(Guid.NewGuid(), "Oman"), - new Country(Guid.NewGuid(), "Pakistan"), - new Country(Guid.NewGuid(), "Palau"), - new Country(Guid.NewGuid(), "Palestine State"), - new Country(Guid.NewGuid(), "Panama"), - new Country(Guid.NewGuid(), "Papua New Guinea"), - new Country(Guid.NewGuid(), "Paraguay"), - new Country(Guid.NewGuid(), "Peru"), - new Country(Guid.NewGuid(), "Philippines"), - new Country(Guid.NewGuid(), "Poland"), - new Country(Guid.NewGuid(), "Portugal"), - new Country(Guid.NewGuid(), "Qatar"), - new Country(Guid.NewGuid(), "Romania"), - new Country(Guid.NewGuid(), "Russia"), - new Country(Guid.NewGuid(), "Rwanda"), - new Country(Guid.NewGuid(), "Saint Kitts and Nevis"), - new Country(Guid.NewGuid(), "Saint Lucia"), - new Country(Guid.NewGuid(), "Saint Vincent and the Grenadines"), - new Country(Guid.NewGuid(), "Samoa"), - new Country(Guid.NewGuid(), "San Marino"), - new Country(Guid.NewGuid(), "Sao Tome and Principe"), - new Country(Guid.NewGuid(), "Saudi Arabia"), - new Country(Guid.NewGuid(), "Senegal"), - new Country(Guid.NewGuid(), "Serbia"), - new Country(Guid.NewGuid(), "Seychelles"), - new Country(Guid.NewGuid(), "Sierra Leone"), - new Country(Guid.NewGuid(), "Singapore"), - new Country(Guid.NewGuid(), "Slovakia"), - new Country(Guid.NewGuid(), "Slovenia"), - new Country(Guid.NewGuid(), "Solomon Islands"), - new Country(Guid.NewGuid(), "Somalia"), - new Country(Guid.NewGuid(), "South Africa"), - new Country(Guid.NewGuid(), "South Korea"), - new Country(Guid.NewGuid(), "South Sudan"), - new Country(Guid.NewGuid(), "Spain"), - new Country(Guid.NewGuid(), "Sri Lanka"), - new Country(Guid.NewGuid(), "Sudan"), - new Country(Guid.NewGuid(), "Suriname"), - new Country(Guid.NewGuid(), "Sweden"), - new Country(Guid.NewGuid(), "Switzerland"), - new Country(Guid.NewGuid(), "Syria"), - new Country(Guid.NewGuid(), "Tajikistan"), - new Country(Guid.NewGuid(), "Tanzania"), - new Country(Guid.NewGuid(), "Thailand"), - new Country(Guid.NewGuid(), "Timor-Leste"), - new Country(Guid.NewGuid(), "Togo"), - new Country(Guid.NewGuid(), "Tonga"), - new Country(Guid.NewGuid(), "Trinidad and Tobago"), - new Country(Guid.NewGuid(), "Tunisia"), - new Country(Guid.NewGuid(), "Turkey"), - new Country(Guid.NewGuid(), "Turkmenistan"), - new Country(Guid.NewGuid(), "Tuvalu"), - new Country(Guid.NewGuid(), "Uganda"), - new Country(Guid.NewGuid(), "Ukraine"), - new Country(Guid.NewGuid(), "United Arab Emirates"), - new Country(Guid.NewGuid(), "United Kingdom"), - new Country(Guid.NewGuid(), "United States of America"), - new Country(Guid.NewGuid(), "Uruguay"), - new Country(Guid.NewGuid(), "Uzbekistan"), - new Country(Guid.NewGuid(), "Vanuatu"), - new Country(Guid.NewGuid(), "Venezuela"), - new Country(Guid.NewGuid(), "Vietnam"), - new Country(Guid.NewGuid(), "Yemen"), - new Country(Guid.NewGuid(), "Zambia"), - new Country(Guid.NewGuid(), "Zimbabwe") + new Country(_guidGenerator.Create(), "Afghanistan"), + new Country(_guidGenerator.Create(), "Albania"), + new Country(_guidGenerator.Create(), "Algeria"), + new Country(_guidGenerator.Create(), "Andorra"), + new Country(_guidGenerator.Create(), "Angola"), + new Country(_guidGenerator.Create(), "Antigua and Barbuda"), + new Country(_guidGenerator.Create(), "Argentina"), + new Country(_guidGenerator.Create(), "Armenia"), + new Country(_guidGenerator.Create(), "Australia"), + new Country(_guidGenerator.Create(), "Austria"), + new Country(_guidGenerator.Create(), "Azerbaijan"), + new Country(_guidGenerator.Create(), "Bahamas"), + new Country(_guidGenerator.Create(), "Bahrain"), + new Country(_guidGenerator.Create(), "Bangladesh"), + new Country(_guidGenerator.Create(), "Barbados"), + new Country(_guidGenerator.Create(), "Belarus"), + new Country(_guidGenerator.Create(), "Belgium"), + new Country(_guidGenerator.Create(), "Belize"), + new Country(_guidGenerator.Create(), "Benin"), + new Country(_guidGenerator.Create(), "Bhutan"), + new Country(_guidGenerator.Create(), "Bolivia"), + new Country(_guidGenerator.Create(), "Bosnia and Herzegovina"), + new Country(_guidGenerator.Create(), "Botswana"), + new Country(_guidGenerator.Create(), "Brazil"), + new Country(_guidGenerator.Create(), "Brunei"), + new Country(_guidGenerator.Create(), "Bulgaria"), + new Country(_guidGenerator.Create(), "Burkina Faso"), + new Country(_guidGenerator.Create(), "Burundi"), + new Country(_guidGenerator.Create(), "Côte d'Ivoire"), + new Country(_guidGenerator.Create(), "Cabo Verde"), + new Country(_guidGenerator.Create(), "Cambodia"), + new Country(_guidGenerator.Create(), "Cameroon"), + new Country(_guidGenerator.Create(), "Canada"), + new Country(_guidGenerator.Create(), "Central African Republic"), + new Country(_guidGenerator.Create(), "Chad"), + new Country(_guidGenerator.Create(), "Chile"), + new Country(_guidGenerator.Create(), "China"), + new Country(_guidGenerator.Create(), "Colombia"), + new Country(_guidGenerator.Create(), "Comoros"), + new Country(_guidGenerator.Create(), "Congo (Congo-Brazzaville)"), + new Country(_guidGenerator.Create(), "Costa Rica"), + new Country(_guidGenerator.Create(), "Croatia"), + new Country(_guidGenerator.Create(), "Cuba"), + new Country(_guidGenerator.Create(), "Cyprus"), + new Country(_guidGenerator.Create(), "Czechia (Czech Republic)"), + new Country(_guidGenerator.Create(), "Democratic Republic of the Congo"), + new Country(_guidGenerator.Create(), "Denmark"), + new Country(_guidGenerator.Create(), "Djibouti"), + new Country(_guidGenerator.Create(), "Dominica"), + new Country(_guidGenerator.Create(), "Dominican Republic"), + new Country(_guidGenerator.Create(), "Ecuador"), + new Country(_guidGenerator.Create(), "Egypt"), + new Country(_guidGenerator.Create(), "El Salvador"), + new Country(_guidGenerator.Create(), "Equatorial Guinea"), + new Country(_guidGenerator.Create(), "Eritrea"), + new Country(_guidGenerator.Create(), "Estonia"), + new Country(_guidGenerator.Create(), "Eswatini (formerly Swaziland)"), + new Country(_guidGenerator.Create(), "Ethiopia"), + new Country(_guidGenerator.Create(), "Fiji"), + new Country(_guidGenerator.Create(), "Finland"), + new Country(_guidGenerator.Create(), "France"), + new Country(_guidGenerator.Create(), "Gabon"), + new Country(_guidGenerator.Create(), "Gambia"), + new Country(_guidGenerator.Create(), "Georgia"), + new Country(_guidGenerator.Create(), "Germany"), + new Country(_guidGenerator.Create(), "Ghana"), + new Country(_guidGenerator.Create(), "Greece"), + new Country(_guidGenerator.Create(), "Grenada"), + new Country(_guidGenerator.Create(), "Guatemala"), + new Country(_guidGenerator.Create(), "Guinea"), + new Country(_guidGenerator.Create(), "Guinea-Bissau"), + new Country(_guidGenerator.Create(), "Guyana"), + new Country(_guidGenerator.Create(), "Haiti"), + new Country(_guidGenerator.Create(), "Holy See"), + new Country(_guidGenerator.Create(), "Honduras"), + new Country(_guidGenerator.Create(), "Hungary"), + new Country(_guidGenerator.Create(), "Iceland"), + new Country(_guidGenerator.Create(), "India"), + new Country(_guidGenerator.Create(), "Indonesia"), + new Country(_guidGenerator.Create(), "Iran"), + new Country(_guidGenerator.Create(), "Iraq"), + new Country(_guidGenerator.Create(), "Ireland"), + new Country(_guidGenerator.Create(), "Israel"), + new Country(_guidGenerator.Create(), "Italy"), + new Country(_guidGenerator.Create(), "Jamaica"), + new Country(_guidGenerator.Create(), "Japan"), + new Country(_guidGenerator.Create(), "Jordan"), + new Country(_guidGenerator.Create(), "Kazakhstan"), + new Country(_guidGenerator.Create(), "Kenya"), + new Country(_guidGenerator.Create(), "Kiribati"), + new Country(_guidGenerator.Create(), "Kuwait"), + new Country(_guidGenerator.Create(), "Kyrgyzstan"), + new Country(_guidGenerator.Create(), "Laos"), + new Country(_guidGenerator.Create(), "Latvia"), + new Country(_guidGenerator.Create(), "Lebanon"), + new Country(_guidGenerator.Create(), "Lesotho"), + new Country(_guidGenerator.Create(), "Liberia"), + new Country(_guidGenerator.Create(), "Libya"), + new Country(_guidGenerator.Create(), "Liechtenstein"), + new Country(_guidGenerator.Create(), "Lithuania"), + new Country(_guidGenerator.Create(), "Luxembourg"), + new Country(_guidGenerator.Create(), "Madagascar"), + new Country(_guidGenerator.Create(), "Malawi"), + new Country(_guidGenerator.Create(), "Malaysia"), + new Country(_guidGenerator.Create(), "Maldives"), + new Country(_guidGenerator.Create(), "Mali"), + new Country(_guidGenerator.Create(), "Malta"), + new Country(_guidGenerator.Create(), "Marshall Islands"), + new Country(_guidGenerator.Create(), "Mauritania"), + new Country(_guidGenerator.Create(), "Mauritius"), + new Country(_guidGenerator.Create(), "Mexico"), + new Country(_guidGenerator.Create(), "Micronesia"), + new Country(_guidGenerator.Create(), "Moldova"), + new Country(_guidGenerator.Create(), "Monaco"), + new Country(_guidGenerator.Create(), "Mongolia"), + new Country(_guidGenerator.Create(), "Montenegro"), + new Country(_guidGenerator.Create(), "Morocco"), + new Country(_guidGenerator.Create(), "Mozambique"), + new Country(_guidGenerator.Create(), "Myanmar (formerly Burma)"), + new Country(_guidGenerator.Create(), "Namibia"), + new Country(_guidGenerator.Create(), "Nauru"), + new Country(_guidGenerator.Create(), "Nepal"), + new Country(_guidGenerator.Create(), "Netherlands"), + new Country(_guidGenerator.Create(), "New Zealand"), + new Country(_guidGenerator.Create(), "Nicaragua"), + new Country(_guidGenerator.Create(), "Niger"), + new Country(_guidGenerator.Create(), "Nigeria"), + new Country(_guidGenerator.Create(), "North Korea"), + new Country(_guidGenerator.Create(), "North Macedonia"), + new Country(_guidGenerator.Create(), "Norway"), + new Country(_guidGenerator.Create(), "Oman"), + new Country(_guidGenerator.Create(), "Pakistan"), + new Country(_guidGenerator.Create(), "Palau"), + new Country(_guidGenerator.Create(), "Palestine State"), + new Country(_guidGenerator.Create(), "Panama"), + new Country(_guidGenerator.Create(), "Papua New Guinea"), + new Country(_guidGenerator.Create(), "Paraguay"), + new Country(_guidGenerator.Create(), "Peru"), + new Country(_guidGenerator.Create(), "Philippines"), + new Country(_guidGenerator.Create(), "Poland"), + new Country(_guidGenerator.Create(), "Portugal"), + new Country(_guidGenerator.Create(), "Qatar"), + new Country(_guidGenerator.Create(), "Romania"), + new Country(_guidGenerator.Create(), "Russia"), + new Country(_guidGenerator.Create(), "Rwanda"), + new Country(_guidGenerator.Create(), "Saint Kitts and Nevis"), + new Country(_guidGenerator.Create(), "Saint Lucia"), + new Country(_guidGenerator.Create(), "Saint Vincent and the Grenadines"), + new Country(_guidGenerator.Create(), "Samoa"), + new Country(_guidGenerator.Create(), "San Marino"), + new Country(_guidGenerator.Create(), "Sao Tome and Principe"), + new Country(_guidGenerator.Create(), "Saudi Arabia"), + new Country(_guidGenerator.Create(), "Senegal"), + new Country(_guidGenerator.Create(), "Serbia"), + new Country(_guidGenerator.Create(), "Seychelles"), + new Country(_guidGenerator.Create(), "Sierra Leone"), + new Country(_guidGenerator.Create(), "Singapore"), + new Country(_guidGenerator.Create(), "Slovakia"), + new Country(_guidGenerator.Create(), "Slovenia"), + new Country(_guidGenerator.Create(), "Solomon Islands"), + new Country(_guidGenerator.Create(), "Somalia"), + new Country(_guidGenerator.Create(), "South Africa"), + new Country(_guidGenerator.Create(), "South Korea"), + new Country(_guidGenerator.Create(), "South Sudan"), + new Country(_guidGenerator.Create(), "Spain"), + new Country(_guidGenerator.Create(), "Sri Lanka"), + new Country(_guidGenerator.Create(), "Sudan"), + new Country(_guidGenerator.Create(), "Suriname"), + new Country(_guidGenerator.Create(), "Sweden"), + new Country(_guidGenerator.Create(), "Switzerland"), + new Country(_guidGenerator.Create(), "Syria"), + new Country(_guidGenerator.Create(), "Tajikistan"), + new Country(_guidGenerator.Create(), "Tanzania"), + new Country(_guidGenerator.Create(), "Thailand"), + new Country(_guidGenerator.Create(), "Timor-Leste"), + new Country(_guidGenerator.Create(), "Togo"), + new Country(_guidGenerator.Create(), "Tonga"), + new Country(_guidGenerator.Create(), "Trinidad and Tobago"), + new Country(_guidGenerator.Create(), "Tunisia"), + new Country(_guidGenerator.Create(), "Turkey"), + new Country(_guidGenerator.Create(), "Turkmenistan"), + new Country(_guidGenerator.Create(), "Tuvalu"), + new Country(_guidGenerator.Create(), "Uganda"), + new Country(_guidGenerator.Create(), "Ukraine"), + new Country(_guidGenerator.Create(), "United Arab Emirates"), + new Country(_guidGenerator.Create(), "United Kingdom"), + new Country(_guidGenerator.Create(), "United States of America"), + new Country(_guidGenerator.Create(), "Uruguay"), + new Country(_guidGenerator.Create(), "Uzbekistan"), + new Country(_guidGenerator.Create(), "Vanuatu"), + new Country(_guidGenerator.Create(), "Venezuela"), + new Country(_guidGenerator.Create(), "Vietnam"), + new Country(_guidGenerator.Create(), "Yemen"), + new Country(_guidGenerator.Create(), "Zambia"), + new Country(_guidGenerator.Create(), "Zimbabwe") }; await _countryRepository.InsertManyAsync(countries, autoSave: true); } } -} \ No newline at end of file +} From ab15344477512e6ab2cb1b595c6f2a501f851837 Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Fri, 17 Dec 2021 15:39:49 +0300 Subject: [PATCH 32/44] Update _newEventSection.cshtml --- .../Events/Components/CreateEventArea/_newEventSection.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml index 5b973bd..4704d1c 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_newEventSection.cshtml @@ -89,7 +89,7 @@
@if (eventId.HasValue) { -
+
} else From 4a22f2ce9798dc345367c7c647b7db9ff0599ad6 Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Mon, 20 Dec 2021 15:58:39 +0300 Subject: [PATCH 33/44] fix: change signature of AddSessionAsync method --- .../Events/AddSessionDto.cs | 2 -- .../Events/IEventAppService.cs | 2 +- src/EventHub.Application/Events/EventAppService.cs | 8 +++----- .../Controllers/Events/EventController.cs | 6 +++--- .../Components/CreateEventArea/_addSessionSection.cshtml | 2 +- .../Components/CreateEventArea/create-event-area.js | 5 ++++- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/EventHub.Application.Contracts/Events/AddSessionDto.cs b/src/EventHub.Application.Contracts/Events/AddSessionDto.cs index c1609e9..c74ae79 100644 --- a/src/EventHub.Application.Contracts/Events/AddSessionDto.cs +++ b/src/EventHub.Application.Contracts/Events/AddSessionDto.cs @@ -6,8 +6,6 @@ namespace EventHub.Events; public class AddSessionDto { - public Guid TrackId { get; set; } - [Required] [StringLength(SessionConsts.MaxTitleLength, MinimumLength = SessionConsts.MinTitleLength)] public string Title { get; set; } diff --git a/src/EventHub.Application.Contracts/Events/IEventAppService.cs b/src/EventHub.Application.Contracts/Events/IEventAppService.cs index 4390f28..f35f7ce 100644 --- a/src/EventHub.Application.Contracts/Events/IEventAppService.cs +++ b/src/EventHub.Application.Contracts/Events/IEventAppService.cs @@ -33,7 +33,7 @@ namespace EventHub.Events Task DeleteTrackAsync(Guid id, Guid trackId); - Task AddSessionAsync(Guid id, AddSessionDto input); + Task AddSessionAsync(Guid id, Guid trackId, AddSessionDto input); Task UpdateSessionAsync(Guid id, Guid trackId, Guid sessionId, UpdateSessionDto input); diff --git a/src/EventHub.Application/Events/EventAppService.cs b/src/EventHub.Application/Events/EventAppService.cs index 15e8a5c..0dbdae7 100644 --- a/src/EventHub.Application/Events/EventAppService.cs +++ b/src/EventHub.Application/Events/EventAppService.cs @@ -79,8 +79,6 @@ namespace EventHub.Events { await SaveCoverImageAsync(@event.Id, input.CoverImageStreamContent); } - - @event.Publish(false); await _eventRepository.InsertAsync(@event); @@ -333,14 +331,14 @@ namespace EventHub.Events } [Authorize] - public async Task AddSessionAsync(Guid id, AddSessionDto input) + public async Task AddSessionAsync(Guid id, Guid trackId, AddSessionDto input) { await CheckIfValidUserNamesAsync(input.SpeakerUserNames); var @event = await _eventRepository.GetAsync(id); await CheckIfValidOwnerAsync(@event); @event.AddSession( - input.TrackId, + trackId, GuidGenerator.Create(), input.Title, input.Description, @@ -364,9 +362,9 @@ namespace EventHub.Events trackId, sessionId, input.Title, + input.Description, Clock.Normalize(input.StartTime), Clock.Normalize(input.EndTime), - input.Description, input.Language, await GetUserIdsByUserNamesAsync(input.SpeakerUserNames) ); diff --git a/src/EventHub.HttpApi/Controllers/Events/EventController.cs b/src/EventHub.HttpApi/Controllers/Events/EventController.cs index f918f72..e787422 100644 --- a/src/EventHub.HttpApi/Controllers/Events/EventController.cs +++ b/src/EventHub.HttpApi/Controllers/Events/EventController.cs @@ -111,11 +111,11 @@ namespace EventHub.Controllers.Events } [HttpPost] - [Route("{id}/sessions")] - public async Task AddSessionAsync(Guid id, AddSessionDto input) + [Route("{id}/tracks/{trackId}/sessions")] + public async Task AddSessionAsync(Guid id, Guid trackId, AddSessionDto input) { input.SpeakerUserNames = input.SpeakerUserNames.Where(x => !x.IsNullOrWhiteSpace()).ToList(); - await _eventAppService.AddSessionAsync(id, input); + await _eventAppService.AddSessionAsync(id, trackId, input); } [HttpPut] diff --git a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml index ff49bc8..1ade97c 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml @@ -118,7 +118,7 @@
- +