Added identifier and fetch time product listings; Added persistence to AdafruitShop.
Implemented in AdafruitShop. AdafruitShop Product listing data now persisted. AdafruitShop configuration now persisted.
This commit is contained in:
@@ -15,9 +15,10 @@ namespace Props.Shop.Framework
|
||||
|
||||
public IAsyncEnumerable<ProductListing> Search(string query, Filters filters);
|
||||
|
||||
public Task<ProductListing> GetProductListingFromUrl(string url);
|
||||
public Task<ProductListing> GetProductFromIdentifier(string identifier);
|
||||
|
||||
void Initialize(string workspaceDir, ILoggerFactory loggerFactory);
|
||||
ValueTask SaveData();
|
||||
public SupportedFeatures SupportedFeatures { get; }
|
||||
}
|
||||
}
|
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
namespace Props.Shop.Framework
|
||||
{
|
||||
public class ProductListing
|
||||
@@ -13,5 +15,41 @@ namespace Props.Shop.Framework
|
||||
public int? ReviewCount { get; set; }
|
||||
public bool ConvertedPrices { get; set; }
|
||||
public bool? InStock { get; set; }
|
||||
public string Identifier { get; set; }
|
||||
public DateTime TimeFetchedUtc { get; set; }
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ProductListing other = obj as ProductListing;
|
||||
return
|
||||
this.LowerPrice == other.LowerPrice &&
|
||||
this.UpperPrice == other.UpperPrice &&
|
||||
this.Shipping == other.Shipping &&
|
||||
this.Name == other.Name &&
|
||||
this.URL == other.URL &&
|
||||
this.ImageURL == other.ImageURL &&
|
||||
this.Rating == other.Rating &&
|
||||
this.PurchaseCount == other.PurchaseCount &&
|
||||
this.ReviewCount == other.ReviewCount &&
|
||||
this.ConvertedPrices == other.ConvertedPrices &&
|
||||
this.InStock == other.InStock &&
|
||||
this.Identifier == other.Identifier &&
|
||||
this.TimeFetchedUtc == other.TimeFetchedUtc;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (Name, URL, UpperPrice, LowerPrice, ImageURL).GetHashCode();
|
||||
}
|
||||
|
||||
public ProductListing Copy()
|
||||
{
|
||||
return MemberwiseClone() as ProductListing;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user