From 4011b6fbe812f2aac25ac5b75b865594f2c9f8a4 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 4 Jan 2022 15:51:35 +0530 Subject: [PATCH] move trash related types to types/trash --- src/pages/gallery/index.tsx | 3 ++- src/services/trashService.ts | 11 +---------- src/types/trash/index.ts | 11 +++++++++++ 3 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 src/types/trash/index.ts diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index da09e0da1..a220c78ae 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -87,8 +87,9 @@ import { getLocalTrash, getTrashedFiles, syncTrash, - Trash, } from 'services/trashService'; +import { Trash } from 'types/trash'; + import DeleteBtn from 'components/DeleteBtn'; import FixCreationTime, { FixCreationTimeAttributes, diff --git a/src/services/trashService.ts b/src/services/trashService.ts index c31f63176..70cfea220 100644 --- a/src/services/trashService.ts +++ b/src/services/trashService.ts @@ -9,6 +9,7 @@ import { getCollection } from './collectionService'; import { EnteFile } from 'types/file'; import HTTPService from './HTTPService'; +import { Trash, TrashItem } from 'types/trash'; const TRASH = 'file-trash'; const TRASH_TIME = 'trash-time'; @@ -16,16 +17,6 @@ const DELETED_COLLECTION = 'deleted-collection'; const ENDPOINT = getEndpoint(); -export interface TrashItem { - file: EnteFile; - isDeleted: boolean; - isRestored: boolean; - deleteBy: number; - createdAt: number; - updatedAt: number; -} -export type Trash = TrashItem[]; - export async function getLocalTrash() { const trash = (await localForage.getItem(TRASH)) || []; return trash; diff --git a/src/types/trash/index.ts b/src/types/trash/index.ts new file mode 100644 index 000000000..9a9492ce6 --- /dev/null +++ b/src/types/trash/index.ts @@ -0,0 +1,11 @@ +import { EnteFile } from 'types/file'; + +export interface TrashItem { + file: EnteFile; + isDeleted: boolean; + isRestored: boolean; + deleteBy: number; + createdAt: number; + updatedAt: number; +} +export type Trash = TrashItem[];