Skip to content

Commit

Permalink
(#438) events: udpate application commands and dto
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintAngeLs committed Oct 27, 2024
1 parent 3a232c9 commit d7cd309
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class CreateEvent : ICommand
public string City { get; set; }
public string ZipCode { get; set; }
public string Country { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
public IEnumerable<string> MediaFilesUrl { get; set; }
public string BannerUrl { get; set; }
public string Description { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,16 @@ public async Task HandleAsync(CreateEvent command, CancellationToken cancellatio
_eventValidator.ValidateDates(startDate, endDate, "event_start_date", "event_end_date");

// Create Address object
var address = new Address(command.BuildingName, command.Street, command.BuildingNumber, command.ApartmentNumber, command.City, command.ZipCode, command.Country);
var address = new Address(
command.BuildingName,
command.Street,
command.BuildingNumber,
command.ApartmentNumber,
command.City,
command.ZipCode,
command.Country,
command.Latitude,
command.Longitude);

// Validate Capacity and Fee
_eventValidator.ValidateCapacity(command.Capacity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ public async Task HandleAsync(UpdateEvent command, CancellationToken cancellatio
_eventValidator.ValidateDates(now, startDate, "now", "event_start_date");
_eventValidator.ValidateDates(startDate, endDate, "event_start_date", "event_end_date");

var address = @event.Location.Update(command.BuildingName, command.Street, command.BuildingNumber,
command.ApartmentNumber, command.City, command.ZipCode, command.Country);
var address = @event.Location.Update(command.BuildingName, command.Street, command.BuildingNumber,
command.ApartmentNumber, command.City, command.ZipCode, command.Country, command.Latitude, command.Longitude);

_eventValidator.ValidateCapacity(command.Capacity);
_eventValidator.ValidateFee(command.Fee);
var category = _eventValidator.ParseCategory(command.Category);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class UpdateEvent : ICommand
public string City { get; }
public string ZipCode { get; }
public string Country { get; }
public double Latitude { get; }
public double Longitude { get; }
public IEnumerable<string> MediaFilesUrl { get; }
public string BannerUrl { get; }
public string Description { get; }
Expand All @@ -35,9 +37,9 @@ public class UpdateEvent : ICommand

public UpdateEvent(Guid eventId, string name, OrganizerType organizerType, Guid organizerId, Guid organizationId,
Guid rootOrganizationId, string startDate, string endDate, string buildingName, string street,
string buildingNumber, string apartmentNumber, string city, string zipCode, string country, IEnumerable<string> mediaFiles,
string bannerUrl, string description, int capacity, decimal fee, string category, string publishDate,
Visibility visibility, EventSettings settings)
string buildingNumber, string apartmentNumber, string city, string zipCode, string country, double latitude,
double longitude, IEnumerable<string> mediaFiles, string bannerUrl, string description, int capacity,
decimal fee, string category, string publishDate, Visibility visibility, EventSettings settings)
{
EventId = eventId;
Name = name;
Expand All @@ -54,6 +56,8 @@ public UpdateEvent(Guid eventId, string name, OrganizerType organizerType, Guid
City = city;
ZipCode = zipCode;
Country = country;
Latitude = latitude;
Longitude = longitude;
MediaFilesUrl = mediaFiles;
BannerUrl = bannerUrl;
Description = description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@ namespace MiniSpace.Services.Events.Application.DTO
[ExcludeFromCodeCoverage]
public class AddressDto
{
// Properties
public string BuildingName { get; set; }
public string Street { get; set; }
public string BuildingNumber { get; set; }
public string ApartmentNumber { get; set; }
public string City { get; set; }
public string ZipCode { get; set; }
public string Country { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }


// Default constructor
public AddressDto()
{
}

public AddressDto(Address address)
{
BuildingName = address.BuildingName;
Expand All @@ -28,6 +31,8 @@ public AddressDto(Address address)
City = address.City;
ZipCode = address.ZipCode;
Country = address.Country;
Latitude = address.Latitude;
Longitude = address.Longitude;
}
}
}
}

0 comments on commit d7cd309

Please sign in to comment.