Skip to content

Commit af7faac

Browse files
committed
refactor: move DatabaseProvider, DatabaseCollection, and LRUCacheTypes enums to a new types file
1 parent 89d9fd3 commit af7faac

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

src/app/core/services/config.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import APP_CONFIG from '../config/app.json';
22
import ROUTES from '../../routes/paths.json';
3-
import { DatabaseProvider } from '../../database/services/database.service';
3+
import { DatabaseProvider } from '../../database/types';
44
import { AppConfig, AppViewConfig, AppViewLayout } from '../types';
55
import { DownloadFolderMethod } from '../../drive/types';
66
import envService from 'app/core/services/env.service';

src/app/database/services/database.service/index.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,10 @@ import { DBSchema } from 'idb';
22
import configService from '../../../core/services/config.service';
33
import { DriveItemData } from '../../../drive/types';
44
import { TaskStatus } from '../../../tasks/types';
5+
import { DatabaseProvider, DatabaseCollection, LRUCacheTypes } from '../../types';
56
import { LRUCacheStruture } from './LRUCache';
67
import indexedDBService from './indexed-db.service';
78

8-
export enum DatabaseProvider {
9-
IndexedDB = 'indexed-db',
10-
}
11-
12-
export enum DatabaseCollection {
13-
Levels = 'levels',
14-
MoveDialogLevels = 'move_levels',
15-
LevelsBlobs = 'levels_blobs',
16-
LRU_cache = 'lru_cache',
17-
Account_settings = 'account_settings',
18-
UploadItemStatus = 'upload_item_status',
19-
WorkspacesAvatarBlobs = 'workspaces_avatar_blobs',
20-
}
21-
22-
export enum LRUCacheTypes {
23-
LevelsBlobs = 'levels_blobs',
24-
LevelsBlobsPreview = 'levels_blobs_preview',
25-
}
26-
279
export type DriveItemBlobData = {
2810
id: number;
2911
parentId: number;
@@ -103,4 +85,6 @@ const providers: { [key in DatabaseProvider]: DatabaseService } = {
10385
};
10486
const appConfig = configService.getAppConfig();
10587

88+
export { DatabaseProvider, DatabaseCollection, LRUCacheTypes } from '../../types';
89+
10690
export default providers[appConfig.database.provider](appConfig.database.name, appConfig.database.version);

src/app/database/types.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export enum DatabaseProvider {
2+
IndexedDB = 'indexed-db',
3+
}
4+
5+
export enum DatabaseCollection {
6+
Levels = 'levels',
7+
MoveDialogLevels = 'move_levels',
8+
LevelsBlobs = 'levels_blobs',
9+
LRU_cache = 'lru_cache',
10+
Account_settings = 'account_settings',
11+
UploadItemStatus = 'upload_item_status',
12+
WorkspacesAvatarBlobs = 'workspaces_avatar_blobs',
13+
}
14+
15+
export enum LRUCacheTypes {
16+
LevelsBlobs = 'levels_blobs',
17+
LevelsBlobsPreview = 'levels_blobs_preview',
18+
}

0 commit comments

Comments
 (0)