diff --git a/RhSolutions.SkuParser.Api/Models/ProductQuantity.cs b/RhSolutions.SkuParser.Api/Models/ProductQuantity.cs deleted file mode 100644 index d593f8b..0000000 --- a/RhSolutions.SkuParser.Api/Models/ProductQuantity.cs +++ /dev/null @@ -1,30 +0,0 @@ -using CsvHelper.Configuration.Attributes; - -namespace RhSolutions.SkuParser.Models; - -public class ProductQuantity -{ - [Index(0)] - public required Product Product { get; set; } - [Index(1)] - public required double Quantity { get; set; } - - public override bool Equals(object? obj) - { - if (obj == null || GetType() != obj.GetType()) - { - return false; - } - ProductQuantity other = (ProductQuantity)obj; - return Product == other.Product && - Quantity == other.Quantity; - } - - public override int GetHashCode() - { - HashCode hash = new(); - hash.Add(Product); - hash.Add(Quantity); - return hash.ToHashCode(); - } -} diff --git a/RhSolutions.SkuParser.Api/Models/SkuQuantity.cs b/RhSolutions.SkuParser.Api/Models/SkuQuantity.cs new file mode 100644 index 0000000..39ae260 --- /dev/null +++ b/RhSolutions.SkuParser.Api/Models/SkuQuantity.cs @@ -0,0 +1,11 @@ +using CsvHelper.Configuration.Attributes; + +namespace RhSolutions.SkuParser.Models; + +public record SkuQuantity +{ + [Index(0)] + public required string Sku { get; set; } + [Index(1)] + public required double Quantity { get; set; } +} diff --git a/RhSolutions.SkuParser.Api/Services/CommonCsvParser.cs b/RhSolutions.SkuParser.Api/Services/CommonCsvParser.cs index e88ba25..6dfc0da 100644 --- a/RhSolutions.SkuParser.Api/Services/CommonCsvParser.cs +++ b/RhSolutions.SkuParser.Api/Services/CommonCsvParser.cs @@ -20,7 +20,7 @@ public class CommonCsvParser : ISkuParser }; using CsvReader csvReader = new(reader, config); - return csvReader.GetRecords() - .ToDictionary(pq => new Product() { Sku = pq.Product.Sku }, pq => pq.Quantity); + return csvReader.GetRecords() + .ToDictionary(pq => new Product() { Sku = pq.Sku }, pq => pq.Quantity); } }