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.
12 lines
653 B
TypeScript
12 lines
653 B
TypeScript
export interface IDriveService {
|
|
getOrCreateFolder(folderName: string, parentFolderId: string): GoogleAppsScript.Drive.Folder
|
|
saveFile(blob: GoogleAppsScript.Base.Blob, folderId: string): GoogleAppsScript.Drive.File
|
|
getFiles(folderId: string): GoogleAppsScript.Drive.File[]
|
|
getFileById(id: string): GoogleAppsScript.Drive.File
|
|
renameFile(fileId: string, newName: string): void
|
|
trashFile(fileId: string): void
|
|
updateFileProperties(fileId: string, properties: {[key: string]: string}): void
|
|
createFile(blob: GoogleAppsScript.Base.Blob): GoogleAppsScript.Drive.File
|
|
getFileProperties(fileId: string): {[key: string]: string}
|
|
}
|