mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-07-16 17:47:22 +00:00
code style cleanup
This commit is contained in:
@@ -1,89 +1,89 @@
|
||||
namespace Features.Breweries.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the location details of an existing brewery, as returned in <see cref="BreweryDto"/>.
|
||||
/// Represents the location details of an existing brewery, as returned in <see cref="BreweryDto" />.
|
||||
/// </summary>
|
||||
public class BreweryLocationDto
|
||||
{
|
||||
/// <summary>
|
||||
/// The unique identifier of the brewery's location record.
|
||||
/// The unique identifier of the brewery's location record.
|
||||
/// </summary>
|
||||
public Guid BreweryPostLocationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The unique identifier of the brewery post that this location belongs to.
|
||||
/// The unique identifier of the brewery post that this location belongs to.
|
||||
/// </summary>
|
||||
public Guid BreweryPostId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The unique identifier of the city in which the brewery is located.
|
||||
/// The unique identifier of the city in which the brewery is located.
|
||||
/// </summary>
|
||||
public Guid CityId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The primary street address line of the brewery.
|
||||
/// The primary street address line of the brewery.
|
||||
/// </summary>
|
||||
public string AddressLine1 { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// An optional secondary address line (e.g. suite or unit number).
|
||||
/// An optional secondary address line (e.g. suite or unit number).
|
||||
/// </summary>
|
||||
public string? AddressLine2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The postal/ZIP code of the brewery's address.
|
||||
/// The postal/ZIP code of the brewery's address.
|
||||
/// </summary>
|
||||
public string PostalCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The optional geographic coordinates of the brewery, in a raw binary representation.
|
||||
/// The optional geographic coordinates of the brewery, in a raw binary representation.
|
||||
/// </summary>
|
||||
public byte[]? Coordinates { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a brewery post as returned by the brewery endpoints, including its metadata and
|
||||
/// optional location.
|
||||
/// Represents a brewery post as returned by the brewery endpoints, including its metadata and
|
||||
/// optional location.
|
||||
/// </summary>
|
||||
public class BreweryDto
|
||||
{
|
||||
/// <summary>
|
||||
/// The unique identifier of the brewery post.
|
||||
/// The unique identifier of the brewery post.
|
||||
/// </summary>
|
||||
public Guid BreweryPostId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The unique identifier of the user account that created the brewery post.
|
||||
/// The unique identifier of the user account that created the brewery post.
|
||||
/// </summary>
|
||||
public Guid PostedById { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the brewery.
|
||||
/// The name of the brewery.
|
||||
/// </summary>
|
||||
public string BreweryName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// A description of the brewery.
|
||||
/// A description of the brewery.
|
||||
/// </summary>
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The date and time at which the brewery post was created.
|
||||
/// The date and time at which the brewery post was created.
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The date and time at which the brewery post was last updated, or <c>null</c> if it has never been updated.
|
||||
/// The date and time at which the brewery post was last updated, or <c>null</c> if it has never been updated.
|
||||
/// </summary>
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A row-version/concurrency token used to detect conflicting concurrent updates to the brewery post.
|
||||
/// A row-version/concurrency token used to detect conflicting concurrent updates to the brewery post.
|
||||
/// </summary>
|
||||
public byte[]? Timer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The location details of the brewery, or <c>null</c> if no location is associated with it.
|
||||
/// The location details of the brewery, or <c>null</c> if no location is associated with it.
|
||||
/// </summary>
|
||||
public BreweryLocationDto? Location { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -3,34 +3,39 @@ using Domain.Entities;
|
||||
namespace Features.Breweries.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// Maps <see cref="BreweryPost"/> domain entities to their <see cref="BreweryDto"/> wire representation.
|
||||
/// Maps <see cref="BreweryPost" /> domain entities to their <see cref="BreweryDto" /> wire representation.
|
||||
/// </summary>
|
||||
public static class BreweryDtoMapper
|
||||
{
|
||||
/// <summary>
|
||||
/// Maps a <see cref="BreweryPost"/> domain entity to its <see cref="BreweryDto"/> representation,
|
||||
/// including its location, if present.
|
||||
/// Maps a <see cref="BreweryPost" /> domain entity to its <see cref="BreweryDto" /> representation,
|
||||
/// including its location, if present.
|
||||
/// </summary>
|
||||
/// <param name="brewery">The brewery post entity to map.</param>
|
||||
/// <returns>The mapped <see cref="BreweryDto"/>.</returns>
|
||||
public static BreweryDto ToDto(this BreweryPost brewery) => new()
|
||||
/// <returns>The mapped <see cref="BreweryDto" />.</returns>
|
||||
public static BreweryDto ToDto(this BreweryPost brewery)
|
||||
{
|
||||
BreweryPostId = brewery.BreweryPostId,
|
||||
PostedById = brewery.PostedById,
|
||||
BreweryName = brewery.BreweryName,
|
||||
Description = brewery.Description,
|
||||
CreatedAt = brewery.CreatedAt,
|
||||
UpdatedAt = brewery.UpdatedAt,
|
||||
Timer = brewery.Timer,
|
||||
Location = brewery.Location is null ? null : new BreweryLocationDto
|
||||
return new BreweryDto
|
||||
{
|
||||
BreweryPostLocationId = brewery.Location.BreweryPostLocationId,
|
||||
BreweryPostId = brewery.Location.BreweryPostId,
|
||||
CityId = brewery.Location.CityId,
|
||||
AddressLine1 = brewery.Location.AddressLine1,
|
||||
AddressLine2 = brewery.Location.AddressLine2,
|
||||
PostalCode = brewery.Location.PostalCode,
|
||||
Coordinates = brewery.Location.Coordinates,
|
||||
},
|
||||
};
|
||||
}
|
||||
BreweryPostId = brewery.BreweryPostId,
|
||||
PostedById = brewery.PostedById,
|
||||
BreweryName = brewery.BreweryName,
|
||||
Description = brewery.Description,
|
||||
CreatedAt = brewery.CreatedAt,
|
||||
UpdatedAt = brewery.UpdatedAt,
|
||||
Timer = brewery.Timer,
|
||||
Location = brewery.Location is null
|
||||
? null
|
||||
: new BreweryLocationDto
|
||||
{
|
||||
BreweryPostLocationId = brewery.Location.BreweryPostLocationId,
|
||||
BreweryPostId = brewery.Location.BreweryPostId,
|
||||
CityId = brewery.Location.CityId,
|
||||
AddressLine1 = brewery.Location.AddressLine1,
|
||||
AddressLine2 = brewery.Location.AddressLine2,
|
||||
PostalCode = brewery.Location.PostalCode,
|
||||
Coordinates = brewery.Location.Coordinates
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user