forked from internxt/drive-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[_] feat: add time metadata to placeholders (internxt#379)
* feat: add tiem metadata to placeholder * chore: use PlaceholderCreator on files module * feat: use use case to print the placeholder tree
- Loading branch information
1 parent
2453439
commit 5bc68f0
Showing
12 changed files
with
64 additions
and
63 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
2 changes: 2 additions & 0 deletions
2
src/workers/sync-engine/dependency-injection/placeholders/PlaceholdersContainer.ts
This file contains 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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { TreePlaceholderCreator } from 'workers/sync-engine/modules/placeholders/application/TreePlaceholderCreator'; | ||
import { PlaceholderCreator } from '../../modules/placeholders/domain/PlaceholderCreator'; | ||
|
||
export interface PlaceholderContainer { | ||
placeholderCreator: PlaceholderCreator; | ||
treePlaceholderCreator: TreePlaceholderCreator; | ||
} |
13 changes: 11 additions & 2 deletions
13
src/workers/sync-engine/dependency-injection/placeholders/builder.ts
This file contains 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 |
---|---|---|
@@ -1,11 +1,20 @@ | ||
import { TreePlaceholderCreator } from 'workers/sync-engine/modules/placeholders/application/TreePlaceholderCreator'; | ||
import { DependencyInjectionVirtualDrive } from '../common/virtualDrive'; | ||
import { PlaceholderContainer } from './PlaceholdersContainer'; | ||
import { VirtualDrivePlaceholderCreator } from 'workers/sync-engine/modules/placeholders/infrastructure/VirtualDrivePlaceholderCreator'; | ||
import { ItemsContainer } from '../items/ItemsContainer'; | ||
|
||
export function buildPlaceholdersContainer(): PlaceholderContainer { | ||
export function buildPlaceholdersContainer( | ||
itemsContainer: ItemsContainer | ||
): PlaceholderContainer { | ||
const { virtualDrive } = DependencyInjectionVirtualDrive; | ||
|
||
const placeholderCreator = new VirtualDrivePlaceholderCreator(virtualDrive); | ||
|
||
return { placeholderCreator }; | ||
const treePlaceholderCreator = new TreePlaceholderCreator( | ||
itemsContainer.treeBuilder, | ||
placeholderCreator | ||
); | ||
|
||
return { placeholderCreator, treePlaceholderCreator }; | ||
} |
This file contains 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 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
6 changes: 3 additions & 3 deletions
6
src/workers/sync-engine/modules/files/application/FilePlaceholderCreatorFromContentsId.ts
This file contains 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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { PlaceholderCreator } from '../../placeholders/domain/PlaceholderCreator'; | ||
import { File } from '../domain/File'; | ||
import { FilePlaceholderCreator } from '../infrastructure/FilePlaceholderCreator'; | ||
import { FileFinderByContentsId } from './FileFinderByContentsId'; | ||
|
||
export class FilePlaceholderCreatorFromContentsId { | ||
constructor( | ||
private readonly finder: FileFinderByContentsId, | ||
private readonly placeholderCreator: FilePlaceholderCreator | ||
private readonly placeholderCreator: PlaceholderCreator | ||
) {} | ||
|
||
run(contentsId: File['contentsId']) { | ||
const file = this.finder.run(contentsId); | ||
|
||
this.placeholderCreator.run(file); | ||
this.placeholderCreator.file(file); | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
src/workers/sync-engine/modules/files/infrastructure/FilePlaceholderCreator.ts
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
src/workers/sync-engine/modules/placeholders/application/TreePlaceholderCreator.ts
This file contains 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,22 @@ | ||
import { TreeBuilder } from '../../items/application/TreeBuilder'; | ||
import { PlaceholderCreator } from '../domain/PlaceholderCreator'; | ||
|
||
export class TreePlaceholderCreator { | ||
constructor( | ||
// TODO: fix the import form infra | ||
private readonly treeBuilder: TreeBuilder, | ||
private readonly placeholderCreator: PlaceholderCreator | ||
) {} | ||
|
||
async run(): Promise<void> { | ||
const tree = await this.treeBuilder.run(); | ||
|
||
tree.forEach((item) => { | ||
if (item.isFile()) { | ||
return this.placeholderCreator.file(item); | ||
} | ||
|
||
this.placeholderCreator.folder(item); | ||
}); | ||
} | ||
} |
This file contains 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