Skip to content

Commit

Permalink
(#411) events: refactor application
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintAngeLs committed Sep 16, 2024
1 parent 7a7655c commit a97ce1e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ public class AddEventParticipant: ICommand
{
public Guid EventId { get; set; }
public Guid StudentId { get; set; }
public string StudentName { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task HandleAsync(AddEventParticipant command, CancellationToken can
@event.AddParticipant(new Participant(command.StudentId));
await _eventRepository.UpdateAsync(@event);
await _messageBroker.PublishAsync(new EventParticipantAdded(@event.Id,
command.StudentId, command.StudentName));
command.StudentId));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public EventDto(Event @event, Guid studentId)
UpdatedAt = @event.UpdatedAt;
Visibility = @event.Visibility;
Settings = new EventSettingsDto(@event.Settings);
IsSignedUp = @event.SignedUpParticipants.Any(x => x.StudentId == studentId);
IsInterested = @event.InterestedParticipants.Any(x => x.StudentId == studentId);
StudentRating = @event.Ratings.FirstOrDefault(x => x.StudentId == studentId)?.Value;
IsSignedUp = @event.SignedUpParticipants.Any(x => x.UserId == studentId);
IsInterested = @event.InterestedParticipants.Any(x => x.UserId == studentId);
StudentRating = @event.Ratings.FirstOrDefault(x => x.UserId == studentId)?.Value;
FriendsInterestedIn = Enumerable.Empty<ParticipantDto>();
FriendsSignedUp = Enumerable.Empty<ParticipantDto>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ public class EventParticipantAdded: IEvent
{
public Guid EventId { get; }
public Guid ParticipantId { get; }
public string ParticipantName { get; }

public EventParticipantAdded(Guid eventId, Guid participantId, string participantName)
public EventParticipantAdded(Guid eventId, Guid participantId)
{
EventId = eventId;
ParticipantId = participantId;
ParticipantName = participantName;
}
}
}

0 comments on commit a97ce1e

Please sign in to comment.