Repository navigation
feat(web,server): offline/untracked files admin tool - #4447
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
b33cbe6 to
3d7f7b7
Compare
9c7b794 to
6de1c0d
Compare
73ab86c to
bd1fb56
Compare
0b7eadf to
b1dd9ab
Compare
danieldietzler
left a comment
There was a problem hiding this comment.
Thanks! Really nice addition and will improve the overall experience with orphaned files and broken references.
alextran1502
left a comment
There was a problem hiding this comment.
Amazing work! Thank you very much for working on this!
| } | ||
|
|
||
| @AdminRoute() | ||
| @Post('file-report/checksum') |
There was a problem hiding this comment.
Are we using Post here because we need the body?
There was a problem hiding this comment.
Correct, we send a list of files to request checksums for
| }, | ||
| }, | ||
| withDeleted: !!options.trashedBefore, | ||
| withDeleted: options.withDeleted ?? !!options.trashedBefore, |
There was a problem hiding this comment.
Is this a convenient bug fix?
There was a problem hiding this comment.
No, just a new feature so that the report takes soft deleted assets into account
| return results; | ||
| } | ||
|
|
||
| async fixItems(items: FileReportItemDto[]) { |
There was a problem hiding this comment.
We are not perfoming any file moves operation here, how can we fix the orphaned files in the upload folder??
There was a problem hiding this comment.
When we find out where the actual file is stored, we simply update the database to point to it. We decided to fix it on the database side rather than move the file itself.
| } | ||
| } | ||
|
|
||
| const track = (filename: string | null) => { |
There was a problem hiding this comment.
Can you explain a bit about the purpose of this method?
There was a problem hiding this comment.
This is the core of figuring out what files are in the filesystem and not in the database. We start with a list of all the scanned files. Then, as we load assets, people, etc. from the database we're able to mark files as "seen". By removing every file that is referenced by an entity in the database we chip away at the list until only untracked files remain.
There was a problem hiding this comment.
This method specially, is called on every entity and file path we see in the for loops below.
| trashedBefore?: Date; | ||
| type?: AssetType; | ||
| order?: 'ASC' | 'DESC'; | ||
| withDeleted?: boolean; |
There was a problem hiding this comment.
Is this also a convenient bug fix?
There was a problem hiding this comment.
Previously deleted assets were only included in the results when it was used in a specific request for trashed assets. This new option let's me additionally request them for the report query as well
|
|
||
| async getInfo(): Promise<ServerInfoResponseDto> { | ||
| const libraryBase = this.storageCore.getBaseFolder(StorageFolder.LIBRARY); | ||
| const libraryBase = StorageCore.getBaseFolder(StorageFolder.LIBRARY); |
There was a problem hiding this comment.
Nice! make the method static reduces a lot of code.
There was a problem hiding this comment.
Yeah, figured that was simpler 😁
WIP report to show offline files as well as untracked files as a report for the admin.