Refactor Media Manager sync logic and fix duplication bugs
This major refactor addresses improper image matching and duplication: - Implemented strict ID-based matching in 'MediaService', removing the greedy filename matching fallback. - Redesigned synchronization pipeline to treat Google Drive as the Source of Truth, supporting orphan adoption (Shopify -> Drive) and secure uploads. - Implemented 'gallery_order' using Drive file properties (supporting both v2 and v3 APIs) for stable, drag-and-drop global ordering. - Added conditional file renaming using timestamps to enforce '_' naming convention without unnecessary renames. - Fixed runtime errors in 'MediaService' loops and updated 'ShopifyMediaService' GraphQL mutations to match correctly schema. - Rewrote 'MediaService.test.ts' with robust test cases for strict matching, adoption, sorting, and reordering.
This commit is contained in:
@ -4,4 +4,5 @@ export interface IShopifyMediaService {
|
||||
getProductMedia(productId: string): any[]
|
||||
productDeleteMedia(productId: string, mediaId: string): any
|
||||
productReorderMedia(productId: string, moves: any[]): any
|
||||
getShopDomain(): string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user