Skip to content

Commit a97ce1e

Browse files
committed
(#411) events: refactor application
1 parent 7a7655c commit a97ce1e

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

MiniSpace.Services.Events/src/MiniSpace.Services.Events.Application/Commands/AddEventParticipant.cs

-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ public class AddEventParticipant: ICommand
1010
{
1111
public Guid EventId { get; set; }
1212
public Guid StudentId { get; set; }
13-
public string StudentName { get; set; }
1413
}
1514
}

MiniSpace.Services.Events/src/MiniSpace.Services.Events.Application/Commands/Handlers/AddEventParticipantHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public async Task HandleAsync(AddEventParticipant command, CancellationToken can
5454
@event.AddParticipant(new Participant(command.StudentId));
5555
await _eventRepository.UpdateAsync(@event);
5656
await _messageBroker.PublishAsync(new EventParticipantAdded(@event.Id,
57-
command.StudentId, command.StudentName));
57+
command.StudentId));
5858
}
5959
}
6060
}

MiniSpace.Services.Events/src/MiniSpace.Services.Events.Application/DTO/EventDto.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public EventDto(Event @event, Guid studentId)
6060
UpdatedAt = @event.UpdatedAt;
6161
Visibility = @event.Visibility;
6262
Settings = new EventSettingsDto(@event.Settings);
63-
IsSignedUp = @event.SignedUpParticipants.Any(x => x.StudentId == studentId);
64-
IsInterested = @event.InterestedParticipants.Any(x => x.StudentId == studentId);
65-
StudentRating = @event.Ratings.FirstOrDefault(x => x.StudentId == studentId)?.Value;
63+
IsSignedUp = @event.SignedUpParticipants.Any(x => x.UserId == studentId);
64+
IsInterested = @event.InterestedParticipants.Any(x => x.UserId == studentId);
65+
StudentRating = @event.Ratings.FirstOrDefault(x => x.UserId == studentId)?.Value;
6666
FriendsInterestedIn = Enumerable.Empty<ParticipantDto>();
6767
FriendsSignedUp = Enumerable.Empty<ParticipantDto>();
6868
}

MiniSpace.Services.Events/src/MiniSpace.Services.Events.Application/Events/EventParticipantAdded.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ public class EventParticipantAdded: IEvent
88
{
99
public Guid EventId { get; }
1010
public Guid ParticipantId { get; }
11-
public string ParticipantName { get; }
1211

13-
public EventParticipantAdded(Guid eventId, Guid participantId, string participantName)
12+
public EventParticipantAdded(Guid eventId, Guid participantId)
1413
{
1514
EventId = eventId;
1615
ParticipantId = participantId;
17-
ParticipantName = participantName;
1816
}
1917
}
2018
}

0 commit comments

Comments
 (0)