add references

This commit is contained in:
marlon-erler
2024-07-22 01:22:59 +02:00
parent e998fe6686
commit ec3fd9e155
+22 -4
View File
@@ -39,7 +39,8 @@ export default class FileModel {
); );
// check if fileContent already exists // check if fileContent already exists
const existingFileContent: string | null = this.storageModel.read(fileContentPath); const existingFileContent: string | null =
this.storageModel.read(fileContentPath);
if (existingFileContent != null) return; if (existingFileContent != null) return;
const stringifiedContent: string = stringify(fileContent); const stringifiedContent: string = stringify(fileContent);
@@ -104,9 +105,9 @@ export default class FileModel {
dataVersion: DATA_VERSION, dataVersion: DATA_VERSION,
id: v4(), id: v4(),
contentVersions: [] contentVersions: [],
} };
} };
} }
// types // types
@@ -121,3 +122,20 @@ export interface FileContent extends ValidObject {
type: string; type: string;
} }
// references
export const FileContentReference: FileContent = {
dataVersion: DATA_VERSION,
id: "",
creationDate: "",
type: "",
};
export const FileReference: File = {
dataVersion: DATA_VERSION,
id: "",
contentVersions: [FileContentReference],
};