Browse Source
fix: change signature of AddSessionAsync method
pull/79/head
berkansasmaz
5 years ago
No known key found for this signature in database
GPG Key ID: 884D815C3F32BE00
6 changed files with
12 additions and
13 deletions
-
src/EventHub.Application.Contracts/Events/AddSessionDto.cs
-
src/EventHub.Application.Contracts/Events/IEventAppService.cs
-
src/EventHub.Application/Events/EventAppService.cs
-
src/EventHub.HttpApi/Controllers/Events/EventController.cs
-
src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml
-
src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js
|
|
|
@ -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; } |
|
|
|
|
|
|
|
@ -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); |
|
|
|
|
|
|
|
|
|
|
|
@ -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) |
|
|
|
); |
|
|
|
|
|
|
|
@ -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] |
|
|
|
|
|
|
|
@ -118,7 +118,7 @@ |
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|
|
|
</div> |
|
|
|
<form id="AddNewSessionForm"> |
|
|
|
<input type="hidden" id="TrackId" name="TrackId" value="TrackIdPlaceHolder" /> |
|
|
|
<input disabled type="hidden" id="TrackId" name="TrackId" value="TrackIdPlaceHolder" /> |
|
|
|
<div class="modal-body profile-content px-5"> |
|
|
|
<div class="form-floating mb-3"> |
|
|
|
<input type="text" class="form-control" id="TitleInNewSessionModal" name="Title" placeholder=" " required minLength=@SessionConsts.MinTitleLength maxLength=@SessionConsts.MaxTitleLength /> |
|
|
|
|
|
|
|
@ -220,11 +220,14 @@ |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
var addSessionModal = $('#AddSessionModal'); |
|
|
|
var trackId = addSessionModal.find('#TrackId').val(); |
|
|
|
|
|
|
|
var userNameList = $('#SpeakersInNewSessionModal').val().split(/[ , ]+/); |
|
|
|
userNameList = userNameList.filter(v => v !== ''); |
|
|
|
var input = $(this).serializeFormToObject(); |
|
|
|
input.speakerUserNames = userNameList; |
|
|
|
eventApiService.addSession(eventIdInput.val(), input).then(function () { |
|
|
|
eventApiService.addSession(eventIdInput.val(), trackId, input).then(function () { |
|
|
|
$('#AddSessionModal').modal('hide'); |
|
|
|
abp.notify.success('Added the session'); |
|
|
|
FillFilter(stepType.NewSession); |
|
|
|
|