omg it mostly works for deletes

This commit is contained in:
Andras Schmelczer 2025-03-10 22:49:51 +00:00
parent 054d109ef8
commit d23c1a8dbc
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
6 changed files with 243 additions and 139 deletions

View file

@ -71,15 +71,12 @@ export class FileOperations {
`Didn't expect ${path} to exist, deconflicting by moving it to '${deconflictedPath}'`
);
const document = this.database.getDocumentByRelativePath(path);
const document =
this.database.getLatestDocumentByRelativePath(path);
this.logger.debug(
`Existing metadata for ${path}: ${JSON.stringify(document?.metadata)}`
);
this.logger.debug(
`We need to save what's at ${path} to ${deconflictedPath}`
);
if (
document?.metadata !== undefined &&
document.metadata.documentId === documentId
@ -94,7 +91,6 @@ export class FileOperations {
`We need to save what's at ${path} to ${deconflictedPath}`
);
await this.move(path, deconflictedPath, documentId);
// this.database.move(path, deconflictedPath);
} else {
await this.createParentDirectories(path);
}
@ -178,7 +174,8 @@ export class FileOperations {
`Conflict when moving '${oldPath}' to '${newPath}', the latter already exists, deconflicting by moving it to '${deconflictedPath}'`
);
const document = this.database.getDocumentByRelativePath(newPath);
const document =
this.database.getLatestDocumentByRelativePath(newPath);
if (
document?.metadata !== undefined &&