-
Notifications
You must be signed in to change notification settings - Fork 13
[PB-5763]: add-local-cache-database #497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
0b19169
deps: add better-sqlite3 dependency
larryrider 9be5eb3
deps: update dependencies
larryrider 9e31270
refactor: update DRIVE_SQLITE_FILE path to use .db extension and remo…
larryrider 9c30d8d
refactor: remove unused attributes from DriveFile and DriveFolder models
larryrider fd5b2d4
deps: add typeorm dependency to package.json
larryrider 599b122
feat: add DatabaseService for local cache database initialization
larryrider fc90a46
fix: entity name in DriveFolderModel
larryrider dfcb2e7
feat: init database repositories
larryrider eec88ec
feat: init database service
larryrider 31abce2
fix: nullable parentUuid
larryrider 15830bd
feat: add creationTime and modificationTime
larryrider d180c7c
deps: add sql.js dependency
larryrider 176cdc4
feat: support nullable type and fileId, implement updateByUuid
larryrider 214f968
feat: add database clear on webdav start
larryrider b1fe2d5
Merge branch 'main' into feat/pb-5763-add-local-cache-database
larryrider c11260a
fix: nullable fileId and type
larryrider e2280f4
feat: update dependencies
larryrider 309bfcd
feat: add methods for fetching folders by UUID and parent UUID
larryrider a68db6e
feat: add getCurrentRootFolder functionality
larryrider f959f48
feat: add getFolderByPath functionality
larryrider dd3d7d7
fix: improve error reporting
larryrider 606040f
feat: add deleteByParentUuid method to FileRepository and integrate i…
larryrider 24e7bd1
feat: implement generic getByPath functionality
larryrider 7df17c7
refactor: move batch size management and generic folder path retrieval
larryrider 904210a
feat: remove condition from createOrUpdate
larryrider 1f5cb19
Merge branch 'feat/pb-5763-add-local-cache-database' into feat/add-lo…
larryrider 1ac2a43
feat: add unit tests for DatabaseService configuration and integratio…
larryrider 3d6dd98
feat: add maxRetries configuration to sdk apiSecurity
larryrider 9682c59
deps: update fast-xml-parser dependency
larryrider e70e7fd
fix: add missing await
larryrider e1f18c0
feat: handle missing keys with optional parameter
larryrider a5b6032
feat: enhance folder content retrieval with subfolders and subfiles m…
larryrider 4f39c71
feat: implement PathUtils class for file path data extraction
larryrider d4716d9
feat: remove undefined for type and fileId in DriveFile
larryrider ce4bca4
feat: add creationTime and modificationTime to newFolderItem and newD…
larryrider a122dcb
feat: add getByParentUuidNameAndType method
larryrider de10db1
feat: implement getByParentUuidAndName method and enhance getFileMeta…
larryrider 17d1d6b
fix: add missing boolean to tests
larryrider 59c9aad
tests: add default restoreMocks vitest property and fix tests
larryrider a6014c2
fix: refine path trimming logic in getFolderByPathGeneric method
larryrider 09825e7
fix: sonarcloud maintainability issue
larryrider 78271b2
fix: add missing awaits
larryrider 5e26b87
fix: update workspace command descriptions to include WebDAV context
larryrider 51d45cc
tests: add clearMocks default property
larryrider 57c07d9
fix: replace void with await for thumbnail uploads
larryrider 2aa287f
Merge pull request #508 from internxt/feat/add-local-find-by-path
larryrider File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { DataSource } from 'typeorm'; | ||
| import { DriveFileModel } from './drive-file/drive-file.model'; | ||
| import { DriveFolderModel } from './drive-folder/drive-folder.model'; | ||
| import { DRIVE_SQLITE_FILE } from '../../constants/configs'; | ||
| import { ConfigService } from '../config.service'; | ||
|
|
||
| export class DatabaseService { | ||
| public static readonly instance = new DatabaseService(); | ||
|
|
||
| public dataSource = new DataSource( | ||
| ConfigService.instance.get('NODE_ENV', false) === 'test' | ||
| ? { | ||
| type: 'sqljs', | ||
| autoSave: false, | ||
| logging: false, | ||
| synchronize: true, | ||
| entities: [DriveFileModel, DriveFolderModel], | ||
| } | ||
| : { | ||
| type: 'better-sqlite3', | ||
| database: DRIVE_SQLITE_FILE, | ||
| logging: false, | ||
| synchronize: true, | ||
| entities: [DriveFileModel, DriveFolderModel], | ||
| }, | ||
| ); | ||
|
|
||
| public initialize = () => { | ||
| return this.dataSource.initialize(); | ||
| }; | ||
|
|
||
| public destroy = () => { | ||
| return this.dataSource.destroy(); | ||
| }; | ||
|
|
||
| public clear = () => { | ||
| return this.dataSource.synchronize(true); | ||
| }; | ||
|
|
||
| public drop = () => { | ||
| return this.dataSource.dropDatabase(); | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.