From e3827d97e86b391faebb6996f6313e3a51b66a70 Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 16 Apr 2026 01:30:14 +0100 Subject: [PATCH] feat: add CategoryId/Condition/Format/Postcode to SavedListing for draft posting --- EbayListingTool/Models/SavedListing.cs | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/EbayListingTool/Models/SavedListing.cs b/EbayListingTool/Models/SavedListing.cs index a269c09..509426d 100644 --- a/EbayListingTool/Models/SavedListing.cs +++ b/EbayListingTool/Models/SavedListing.cs @@ -11,6 +11,18 @@ public class SavedListing public string ConditionNotes { get; set; } = ""; public string ExportFolder { get; set; } = ""; + /// eBay category ID — stored at save time so we can post without re-looking it up. + public string CategoryId { get; set; } = ""; + + /// Item condition — defaults to Used for existing records without this field. + public ItemCondition Condition { get; set; } = ItemCondition.Used; + + /// Listing format — defaults to FixedPrice for existing records. + public ListingFormat Format { get; set; } = ListingFormat.FixedPrice; + + /// Seller postcode — populated from appsettings default at save time. + public string Postcode { get; set; } = ""; + /// Absolute paths to photos inside ExportFolder. public List PhotoPaths { get; set; } = new(); @@ -19,4 +31,21 @@ public class SavedListing public string PriceDisplay => Price > 0 ? $"£{Price:F2}" : "—"; public string SavedAtDisplay => SavedAt.ToLocalTime().ToString("d MMM yyyy, HH:mm"); + + /// + /// Converts this saved draft back into a ListingDraft suitable for PostListingAsync. + /// + public ListingDraft ToListingDraft() => new ListingDraft + { + Title = Title, + Description = Description, + Price = Price, + CategoryId = CategoryId, + CategoryName = Category, + Condition = Condition, + Format = Format, + Postcode = Postcode, + PhotoPaths = new List(PhotoPaths), + Quantity = 1 + }; }