Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/Basket.API/Model/BasketItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ public IEnumerable<ValidationResult> Validate(ValidationContext validationContex

if (Quantity < 1)
{
results.Add(new ValidationResult("Invalid number of units", new[] { "Quantity" }));
results.Add(new ValidationResult("🤌 Numero di unità non valido", new[] { "Quantity" }));
}

// Validate the URL if it's a valid URL format
if (!string.IsNullOrEmpty(PictureUrl) && !Uri.IsWellFormedUriString(PictureUrl, UriKind.Absolute))
{
results.Add(new ValidationResult("🤌 Formato URL non valido", new[] { "PictureUrl" }));
Comment on lines +19 to +25
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message has been changed from English to Italian with an emoji. This inconsistency in language could cause confusion for users expecting English error messages, and emojis in error messages may not be appropriate for all contexts or systems.

Suggested change
results.Add(new ValidationResult("🤌 Numero di unità non valido", new[] { "Quantity" }));
}
// Validate the URL if it's a valid URL format
if (!string.IsNullOrEmpty(PictureUrl) && !Uri.IsWellFormedUriString(PictureUrl, UriKind.Absolute))
{
results.Add(new ValidationResult("🤌 Formato URL non valido", new[] { "PictureUrl" }));
results.Add(new ValidationResult("Invalid quantity", new[] { "Quantity" }));
}
// Validate the URL if it's a valid URL format
if (!string.IsNullOrEmpty(PictureUrl) && !Uri.IsWellFormedUriString(PictureUrl, UriKind.Absolute))
{
results.Add(new ValidationResult("Invalid URL format", new[] { "PictureUrl" }));

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +25
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new validation error message is in Italian with an emoji, which creates inconsistency with the expected language for the application. Error messages should be consistent in language and professional in tone.

Suggested change
results.Add(new ValidationResult("🤌 Numero di unità non valido", new[] { "Quantity" }));
}
// Validate the URL if it's a valid URL format
if (!string.IsNullOrEmpty(PictureUrl) && !Uri.IsWellFormedUriString(PictureUrl, UriKind.Absolute))
{
results.Add(new ValidationResult("🤌 Formato URL non valido", new[] { "PictureUrl" }));
results.Add(new ValidationResult("Invalid quantity. The number of units must be at least 1.", new[] { "Quantity" }));
}
// Validate the URL if it's a valid URL format
if (!string.IsNullOrEmpty(PictureUrl) && !Uri.IsWellFormedUriString(PictureUrl, UriKind.Absolute))
{
results.Add(new ValidationResult("Invalid URL format. Please provide a valid URL.", new[] { "PictureUrl" }));

Copilot uses AI. Check for mistakes.
}

return results;
Expand Down
18 changes: 18 additions & 0 deletions src/Basket.API/Model/CustomerBasket.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
namespace eShop.Basket.API.Model;

/// <summary>
/// Represents a shopping basket for a specific customer, containing a collection of basket items.
/// </summary>
public class CustomerBasket
{
/// <summary>
/// Gets or sets the unique identifier of the buyer associated with this basket.
/// </summary>
public string BuyerId { get; set; }

/// <summary>
/// Gets or sets the list of items in the customer's basket.
/// Initialized as an empty list by default.
/// </summary>
public List<BasketItem> Items { get; set; } = [];

/// <summary>
/// Initializes a new instance of the <see cref="CustomerBasket"/> class.
/// </summary>
public CustomerBasket() { }

/// <summary>
/// Initializes a new instance of the <see cref="CustomerBasket"/> class
/// with the specified customer identifier.
/// </summary>
/// <param name="customerId">The unique identifier of the customer.</param>
public CustomerBasket(string customerId)
{
BuyerId = customerId;
Expand Down