Browse Source

Remove some TODO, and do refactor

pull/79/head
berkansasmaz 5 years ago
parent
commit
6347a4d960
No known key found for this signature in database GPG Key ID: 884D815C3F32BE00
  1. 1
      src/EventHub.Application/Events/EventAppService.cs
  2. 10
      src/EventHub.Domain/Events/Event.cs
  3. 4
      src/EventHub.Domain/Events/Track.cs
  4. 3
      src/EventHub.Web.Theme/Themes/EventHub/Layouts/Application.cshtml
  5. 12
      src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/Default.cshtml
  6. 4
      src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_eventSection.cshtml
  7. 0
      src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_sessionSection.cshtml
  8. 0
      src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_trackSection.cshtml
  9. 4
      src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/create-or-edit-event-area.js
  10. 4
      src/EventHub.Web/Pages/PrivacyPolicy.cshtml.cs

1
src/EventHub.Application/Events/EventAppService.cs

@ -262,7 +262,6 @@ namespace EventHub.Events
[Authorize] [Authorize]
public async Task UpdateAsync(Guid id, UpdateEventDto input) public async Task UpdateAsync(Guid id, UpdateEventDto input)
{ {
// TODO(berkansasmaz): Should it be updated on past events?
var @event = await _eventRepository.GetAsync(id); var @event = await _eventRepository.GetAsync(id);
await CheckIfValidOwnerAsync(@event); await CheckIfValidOwnerAsync(@event);

10
src/EventHub.Domain/Events/Event.cs

@ -185,9 +185,7 @@ namespace EventHub.Events
ICollection<Guid> speakerUserIds) ICollection<Guid> speakerUserIds)
{ {
CheckIfValidSessionTime(startTime, endTime); 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); var track = GetTrack(trackId);
track.AddSession(sessionId, title, description,startTime, endTime, language, speakerUserIds); track.AddSession(sessionId, title, description,startTime, endTime, language, speakerUserIds);
return this; return this;
@ -243,12 +241,6 @@ namespace EventHub.Events
private void CheckIfValidSessionTime(DateTime startTime, DateTime endTime) 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) if (startTime < this.StartTime || this.EndTime < endTime)
{ {
throw new BusinessException(EventHubErrorCodes.SessionTimeShouldBeInTheEventTime); throw new BusinessException(EventHubErrorCodes.SessionTimeShouldBeInTheEventTime);

4
src/EventHub.Domain/Events/Track.cs

@ -54,7 +54,7 @@ namespace EventHub.Events
if (startTime > endTime) if (startTime > endTime)
{ {
throw new BusinessException(EventHubErrorCodes.EndTimeCantBeEarlierThanStartTime); throw new BusinessException(EventHubErrorCodes.SessionEndTimeCantBeEarlierThanStartTime);
} }
CheckIfValidSessionTime(startTime); CheckIfValidSessionTime(startTime);
@ -76,7 +76,7 @@ namespace EventHub.Events
{ {
if (startTime > endTime) if (startTime > endTime)
{ {
throw new BusinessException(EventHubErrorCodes.EndTimeCantBeEarlierThanStartTime); throw new BusinessException(EventHubErrorCodes.SessionEndTimeCantBeEarlierThanStartTime);
} }
var session = Sessions.Single(x => x.Id == sessionId); var session = Sessions.Single(x => x.Id == sessionId);

3
src/EventHub.Web.Theme/Themes/EventHub/Layouts/Application.cshtml

@ -44,7 +44,6 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>@pageTitle</title> <title>@pageTitle</title>
@* TODO(berkansasmaz): Get SEO content from the marketing team *@
<meta name="description" content="@(!string.IsNullOrEmpty(ViewBag.Description) ? ViewBag.Description : "EventHub Description")"/> <meta name="description" content="@(!string.IsNullOrEmpty(ViewBag.Description) ? ViewBag.Description : "EventHub Description")"/>
<meta property="og:title" content="@(!string.IsNullOrWhiteSpace(ViewBag.OgTitle) ? ViewBag.OgTitle : "EventHub Title")"/> <meta property="og:title" content="@(!string.IsNullOrWhiteSpace(ViewBag.OgTitle) ? ViewBag.OgTitle : "EventHub Title")"/>
<meta property="og:url" content="@Context.Request.GetDisplayUrl()"/> <meta property="og:url" content="@Context.Request.GetDisplayUrl()"/>
@ -88,4 +87,4 @@
@await RenderSectionAsync("scripts", false) @await RenderSectionAsync("scripts", false)
@await Component.InvokeLayoutHookAsync(LayoutHooks.Body.Last, StandardLayouts.Application) @await Component.InvokeLayoutHookAsync(LayoutHooks.Body.Last, StandardLayouts.Application)
</body> </body>
</html> </html>

12
src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/Default.cshtml

@ -18,14 +18,14 @@
} }
} }
<div id="CreateEventContainer" style="@(stepType != CreateOrEditEventAreaViewComponent.ProgressStepType.Event ? "display: none" : "")"> <div id="EventContainer" style="@(stepType != CreateOrEditEventAreaViewComponent.ProgressStepType.Event ? "display: none" : "")">
<partial name="_newEventSection.cshtml" model="@Model"/> <partial name="_eventSection.cshtml" model="@Model"/>
</div> </div>
<div id="CreateTrackContainer" style="@(stepType != CreateOrEditEventAreaViewComponent.ProgressStepType.Track ? "display: none" : "")"> <div id="TrackContainer" style="@(stepType != CreateOrEditEventAreaViewComponent.ProgressStepType.Track ? "display: none" : "")">
<partial name="_addTrackSection.cshtml" model="@Model.Tracks"/> <partial name="_trackSection.cshtml" model="@Model.Tracks"/>
</div> </div>
<div id="CreateSessionContainer" style="@(stepType != CreateOrEditEventAreaViewComponent.ProgressStepType.Session ? "display: none" : "")"> <div id="SessionContainer" style="@(stepType != CreateOrEditEventAreaViewComponent.ProgressStepType.Session ? "display: none" : "")">
<partial name="_addSessionSection.cshtml" model="@Model.Tracks"/> <partial name="_sessionSection.cshtml" model="@Model.Tracks"/>
</div> </div>
<div id="PreviewContainer" style="@(stepType != CreateOrEditEventAreaViewComponent.ProgressStepType.Preview ? "display: none" : "")"> <div id="PreviewContainer" style="@(stepType != CreateOrEditEventAreaViewComponent.ProgressStepType.Preview ? "display: none" : "")">
<partial name="_previewSection.cshtml" model="@Model"/> <partial name="_previewSection.cshtml" model="@Model"/>

4
src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_newEventSection.cshtml → src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_eventSection.cshtml

@ -42,7 +42,7 @@
<div class="col-md-9 mx-auto profile-content"> <div class="col-md-9 mx-auto profile-content">
<div class="card"> <div class="card">
<div class="card-body" style="min-height: 496px"> <div class="card-body" style="min-height: 496px">
<h3 class="mb-4">Create New Event</h3> <h3 class="mb-4">@(eventId.HasValue ? "Edit" : "Create New") Event</h3>
<div class="form"> <div class="form">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
@ -152,7 +152,7 @@
<div class="col-md-12 text-end"> <div class="col-md-12 text-end">
<button id="CreateEventButton" disabled type="submit" class="btn btn-primary btn-lg" <button id="CreateEventButton" disabled type="submit" class="btn btn-primary btn-lg"
data-url="@(eventId.HasValue ? Url.ActionLink("Update", "Event", new {Area = "eventhub", id = eventId!.Value}, null) : Url.ActionLink("Create", "Event", new {Area = "eventhub"}, null))"> data-url="@(eventId.HasValue ? Url.ActionLink("Update", "Event", new {Area = "eventhub", id = eventId!.Value}, null) : Url.ActionLink("Create", "Event", new {Area = "eventhub"}, null))">
Next Step Next Step <i class="fa fa-arrow-right ms-2"></i>
</button> </button>
</div> </div>
</div> </div>

0
src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_addSessionSection.cshtml → src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_sessionSection.cshtml

0
src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_addTrackSection.cshtml → src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/_trackSection.cshtml

4
src/EventHub.Web/Pages/Events/Components/CreateOrEditEventArea/create-or-edit-event-area.js

@ -93,8 +93,8 @@
}); });
function SwitchToTrackCreation() { function SwitchToTrackCreation() {
$('#CreateEventContainer').css('display', 'none'); $('#EventContainer').css('display', 'none');
$('#CreateTrackContainer').css('display', ''); $('#TrackContainer').css('display', '');
ScrollToWrapperBegin(); ScrollToWrapperBegin();
} }

4
src/EventHub.Web/Pages/PrivacyPolicy.cshtml.cs

@ -2,11 +2,11 @@ namespace EventHub.Web.Pages
{ {
public class PrivacyPolicy : EventHubPageModel 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() public void OnGet()
{ {
} }
} }
} }

Loading…
Cancel
Save