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 @@