Browse Source

Rename on the renderer side

Manav Rathi 1 year ago
parent
commit
f775890af7
2 changed files with 31 additions and 18 deletions
  1. 0 14
      web/packages/next/types/file.ts
  2. 31 4
      web/packages/next/types/ipc.ts

+ 0 - 14
web/packages/next/types/file.ts

@@ -26,20 +26,6 @@ export interface DataStream {
     chunkCount: number;
 }
 
-export interface WatchMappingSyncedFile {
-    path: string;
-    uploadedFileID: number;
-    collectionID: number;
-}
-
-export interface WatchMapping {
-    rootFolderName: string;
-    folderPath: string;
-    uploadStrategy: UPLOAD_STRATEGY;
-    syncedFiles: WatchMappingSyncedFile[];
-    ignoredFiles: string[];
-}
-
 export interface EventQueueItem {
     type: "upload" | "trash";
     folderPath: string;

+ 31 - 4
web/packages/next/types/ipc.ts

@@ -3,7 +3,7 @@
 //
 // See [Note: types.ts <-> preload.ts <-> ipc.ts]
 
-import type { ElectronFile, WatchMapping } from "./file";
+import type { ElectronFile } from "./file";
 
 export interface AppUpdateInfo {
     autoUpdatable: boolean;
@@ -298,16 +298,16 @@ export interface Electron {
 
     removeWatchMapping: (folderPath: string) => Promise<void>;
 
-    getWatchMappings: () => Promise<WatchMapping[]>;
+    getWatchMappings: () => Promise<FolderWatch[]>;
 
     updateWatchMappingSyncedFiles: (
         folderPath: string,
-        files: WatchMapping["syncedFiles"],
+        files: FolderWatch["syncedFiles"],
     ) => Promise<void>;
 
     updateWatchMappingIgnoredFiles: (
         folderPath: string,
-        files: WatchMapping["ignoredFiles"],
+        files: FolderWatch["ignoredFiles"],
     ) => Promise<void>;
 
     // - FS legacy
@@ -332,3 +332,30 @@ export interface Electron {
     setToUploadCollection: (collectionName: string) => Promise<void>;
     getDirFiles: (dirPath: string) => Promise<ElectronFile[]>;
 }
+
+/**
+ * A top level folder that was selected by the user for watching.
+ *
+ * The user can set up multiple such watches. Each of these can in turn be
+ * syncing multiple on disk folders to one or more (dependening on the
+ * {@link uploadStrategy}) Ente albums.
+ *
+ * This type is passed across the IPC boundary. It is persisted on the Node.js
+ * side.
+ */
+export interface FolderWatch {
+    rootFolderName: string;
+    uploadStrategy: number;
+    folderPath: string;
+    syncedFiles: FolderWatchSyncedFile[];
+    ignoredFiles: string[];
+}
+
+/**
+ * An on-disk file that was synced as part of a folder watch.
+ */
+export interface FolderWatchSyncedFile {
+    path: string;
+    uploadedFileID: number;
+    collectionID: number;
+}