Use correct types

Not sure if this is expected or some misconfiguration in our case, but the types
generated by electron-store do not have the correct TypeScript types.
This commit is contained in:
Manav Rathi 2024-04-18 13:19:21 +05:30
parent 4852a87ae0
commit 230a8a72ab
No known key found for this signature in database
2 changed files with 13 additions and 21 deletions

View file

@ -1,44 +1,34 @@
import Store, { Schema } from "electron-store";
import { type FolderWatch } from "../../types/ipc";
interface WatchStoreSchema {
interface WatchStore {
mappings: FolderWatch[];
}
const watchStoreSchema: Schema<WatchStoreType> = {
const watchStoreSchema: Schema<WatchStore> = {
mappings: {
type: "array",
items: {
type: "object",
properties: {
rootFolderName: {
type: "string",
},
uploadStrategy: {
type: "number",
},
folderPath: {
type: "string",
},
rootFolderName: { type: "string" },
collectionMapping: { type: "string" },
uploadStrategy: { type: "number" },
folderPath: { type: "string" },
syncedFiles: {
type: "array",
items: {
type: "object",
properties: {
path: {
type: "string",
},
id: {
type: "number",
},
path: { type: "string" },
uploadedFileID: { type: "string" },
collectionID: { type: "string" },
},
},
},
ignoredFiles: {
type: "array",
items: {
type: "string",
},
items: { type: "string" },
},
},
},

View file

@ -11,12 +11,14 @@ export interface AppUpdate {
}
export interface FolderWatch {
// TODO(MR): Is this needed
rootFolderName: string;
uploadStrategy: number;
collectionMapping: CollectionMapping;
folderPath: string;
syncedFiles: FolderWatchSyncedFile[];
ignoredFiles: string[];
}
export type CollectionMapping = "root" | "parent";
export interface FolderWatchSyncedFile {
path: string;