From 4a22f2ce9798dc345367c7c647b7db9ff0599ad6 Mon Sep 17 00:00:00 2001 From: berkansasmaz Date: Mon, 20 Dec 2021 15:58:39 +0300 Subject: [PATCH] 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 @@
- +