define paths

This commit is contained in:
marlon-erler
2024-07-22 12:39:26 +02:00
parent b111cd47dd
commit 71281adbd0
4 changed files with 58 additions and 17 deletions
+9 -15
View File
@@ -496,8 +496,7 @@
board,
name
);
file.contentVersions.add(taskFileContent);
this.fileModel.addOrUpdateFile(file);
this.saveTask(file, taskFileContent);
};
saveTask = (file, newTaskFileContent) => {
file.contentVersions.add(newTaskFileContent);
@@ -550,18 +549,19 @@
handleStringifiedFile = (stringifiedFile) => {
const file = parseValidObject(stringifiedFile, FileReference);
if (file == null) return;
this.handleFile(file);
this.handleFileAndClearContents(file);
};
handleFile = (file) => {
handleFileAndClearContents = (file) => {
for (const fileContent of file.contentVersions) {
this.storeFileContent(file, fileContent);
this.taskModel.handleTaskFileContent(file, fileContent);
file.contentVersions.delete(fileContent);
}
};
// methods
addOrUpdateFile = (file) => {
this.handleFile(file);
this.chatModel.sendMessage("", file);
this.handleFileAndClearContents(file);
};
// storage
storeFileContent = (file, fileContent) => {
@@ -578,10 +578,6 @@
listFileIds = () => {
return this.storageModel.list(this.getBasePath());
};
listFileContents = (file) => {
const filePath = this.getFilePath(file.id);
return this.storageModel.list(filePath);
};
getFile = (fileId) => {
const filePath = this.getFilePath(fileId);
const fileOrNull = this.storageModel.readStringifiable(
@@ -590,6 +586,10 @@
);
return fileOrNull;
};
listFileContents = (file) => {
const filePath = this.getFilePath(file.id);
return this.storageModel.list(filePath);
};
getLatestFileContentName = (fileContentNames) => {
return fileContentNames[fileContentNames.length - 1];
};
@@ -2567,10 +2567,4 @@
ConnectionModal(connectionViewModel),
StorageModal(storageViewModel)
);
console.log(
checkMatchesObjectStructure(
{ a: 1, c: /* @__PURE__ */ new Set() },
{ a: 2, c: /* @__PURE__ */ new Set(["bla"]) }
)
);
})();