From 6347a4d960a6c2ed1a0cc3187f2ee748414b2ab2 Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Tue, 28 Dec 2021 10:47:56 +0300 Subject: [PATCH] Remove some TODO, and do refactor --- src/EventHub.Application/Events/EventAppService.cs | 1 - src/EventHub.Domain/Events/Event.cs | 10 +--------- src/EventHub.Domain/Events/Track.cs | 4 ++-- .../Themes/EventHub/Layouts/Application.cshtml | 3 +-- .../Components/CreateOrEditEventArea/Default.cshtml | 12 ++++++------ ...{_newEventSection.cshtml => _eventSection.cshtml} | 4 ++-- ...dSessionSection.cshtml => _sessionSection.cshtml} | 0 ...{_addTrackSection.cshtml => _trackSection.cshtml} | 0 .../create-or-edit-event-area.js | 4 ++-- src/EventHub.Web/Pages/PrivacyPolicy.cshtml.cs | 4 ++-- 10 files changed, 16 insertions(+), 26 deletions(-) rename src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/{_newEventSection.cshtml => _eventSection.cshtml} (98%) rename src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/{_addSessionSection.cshtml => _sessionSection.cshtml} (100%) rename src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/{_addTrackSection.cshtml => _trackSection.cshtml} (100%) diff --git a/src/EventHub.Application/Events/EventAppService.cs b/src/EventHub.Application/Events/EventAppService.cs index 0a82507..e82aa9c 100644 --- a/src/EventHub.Application/Events/EventAppService.cs +++ b/src/EventHub.Application/Events/EventAppService.cs @@ -262,7 +262,6 @@ namespace EventHub.Events [Authorize] public async Task UpdateAsync(Guid id, UpdateEventDto input) { - // TODO(berkansasmaz): Should it be updated on past events? var @event = await _eventRepository.GetAsync(id); await CheckIfValidOwnerAsync(@event); diff --git a/src/EventHub.Domain/Events/Event.cs b/src/EventHub.Domain/Events/Event.cs index 05f27db..7a57616 100644 --- a/src/EventHub.Domain/Events/Event.cs +++ b/src/EventHub.Domain/Events/Event.cs @@ -185,9 +185,7 @@ namespace EventHub.Events ICollection speakerUserIds) { CheckIfValidSessionTime(startTime, endTime); - - // TODO(berkansasmaz): Add domain rule: The same user cannot be a speaker in more than one session at the same time. - + var track = GetTrack(trackId); track.AddSession(sessionId, title, description,startTime, endTime, language, speakerUserIds); return this; @@ -243,12 +241,6 @@ namespace EventHub.Events private void CheckIfValidSessionTime(DateTime startTime, DateTime endTime) { - // TODO(berkansasmaz): This control is already done in Track and even Session. Do you really need this? - if (startTime > endTime) - { - throw new BusinessException(EventHubErrorCodes.SessionEndTimeCantBeEarlierThanStartTime); - } - if (startTime < this.StartTime || this.EndTime < endTime) { throw new BusinessException(EventHubErrorCodes.SessionTimeShouldBeInTheEventTime); diff --git a/src/EventHub.Domain/Events/Track.cs b/src/EventHub.Domain/Events/Track.cs index def7cf1..ce9a823 100644 --- a/src/EventHub.Domain/Events/Track.cs +++ b/src/EventHub.Domain/Events/Track.cs @@ -54,7 +54,7 @@ namespace EventHub.Events if (startTime > endTime) { - throw new BusinessException(EventHubErrorCodes.EndTimeCantBeEarlierThanStartTime); + throw new BusinessException(EventHubErrorCodes.SessionEndTimeCantBeEarlierThanStartTime); } CheckIfValidSessionTime(startTime); @@ -76,7 +76,7 @@ namespace EventHub.Events { if (startTime > endTime) { - throw new BusinessException(EventHubErrorCodes.EndTimeCantBeEarlierThanStartTime); + throw new BusinessException(EventHubErrorCodes.SessionEndTimeCantBeEarlierThanStartTime); } var session = Sessions.Single(x => x.Id == sessionId); diff --git a/src/EventHub.Web.Theme/Themes/EventHub/Layouts/Application.cshtml b/src/EventHub.Web.Theme/Themes/EventHub/Layouts/Application.cshtml index 8e55ae1..42ae264 100644 --- a/src/EventHub.Web.Theme/Themes/EventHub/Layouts/Application.cshtml +++ b/src/EventHub.Web.Theme/Themes/EventHub/Layouts/Application.cshtml @@ -44,7 +44,6 @@ @pageTitle - @* TODO(berkansasmaz): Get SEO content from the marketing team *@ @@ -88,4 +87,4 @@ @await RenderSectionAsync("scripts", false) @await Component.InvokeLayoutHookAsync(LayoutHooks.Body.Last, StandardLayouts.Application) - \ No newline at end of file + diff --git a/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/Default.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/Default.cshtml index 7c3134a..9d9a1e3 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/Default.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/Default.cshtml @@ -18,14 +18,14 @@ } } -
- +
+
-
- +
+
-
- +
+
diff --git a/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_newEventSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_eventSection.cshtml similarity index 98% rename from src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_newEventSection.cshtml rename to src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_eventSection.cshtml index 1306308..3aba351 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_newEventSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_eventSection.cshtml @@ -42,7 +42,7 @@
-

Create New Event

+

@(eventId.HasValue ? "Edit" : "Create New") Event

@@ -152,7 +152,7 @@
diff --git a/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_addSessionSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_sessionSection.cshtml similarity index 100% rename from src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_addSessionSection.cshtml rename to src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_sessionSection.cshtml diff --git a/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_addTrackSection.cshtml b/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_trackSection.cshtml similarity index 100% rename from src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_addTrackSection.cshtml rename to src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_trackSection.cshtml diff --git a/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/create-or-edit-event-area.js b/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/create-or-edit-event-area.js index 3c6ca0b..4626692 100644 --- a/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/create-or-edit-event-area.js +++ b/src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/create-or-edit-event-area.js @@ -93,8 +93,8 @@ }); function SwitchToTrackCreation() { - $('#CreateEventContainer').css('display', 'none'); - $('#CreateTrackContainer').css('display', ''); + $('#EventContainer').css('display', 'none'); + $('#TrackContainer').css('display', ''); ScrollToWrapperBegin(); } diff --git a/src/EventHub.Web/Pages/PrivacyPolicy.cshtml.cs b/src/EventHub.Web/Pages/PrivacyPolicy.cshtml.cs index df4766c..f4e78b4 100644 --- a/src/EventHub.Web/Pages/PrivacyPolicy.cshtml.cs +++ b/src/EventHub.Web/Pages/PrivacyPolicy.cshtml.cs @@ -2,11 +2,11 @@ namespace EventHub.Web.Pages { public class PrivacyPolicy : EventHubPageModel { - public static string LastUpdateDate { get; set; } = "February 23, 2020"; // ToDo: Change LastUpdateDate + public static string LastUpdateDate { get; set; } = "February 23, 2020"; public void OnGet() { } } -} \ No newline at end of file +}