From a776b977f8518976d13c049fef6ecac5ce86140f Mon Sep 17 00:00:00 2001 From: marlon-erler Date: Mon, 22 Jul 2024 02:16:58 +0200 Subject: [PATCH] integrate TaskModel with FileModel --- src/Model/Files/fileModel.ts | 5 +++++ src/Model/Files/taskModel.ts | 35 +++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/Model/Files/fileModel.ts b/src/Model/Files/fileModel.ts index 9d3b16e9..dfb46e44 100644 --- a/src/Model/Files/fileModel.ts +++ b/src/Model/Files/fileModel.ts @@ -5,12 +5,15 @@ import StorageModel, { storageKeys } from "../Global/storageModel"; import { parseValidObject, stringify } from "../Utility/utility"; import ChatModel from "../Chat/chatModel"; +import TaskModel from "./taskModel"; import { v4 } from "uuid"; export default class FileModel { chatModel: ChatModel; storageModel: StorageModel; + taskModel: TaskModel; + // handler handleStringifiedFile = (stringifiedFile: string): void => { const file: File | null = parseValidObject(stringifiedFile, FileReference); @@ -83,6 +86,8 @@ export default class FileModel { constructor(chatModel: ChatModel, storageModel: StorageModel) { this.chatModel = chatModel; this.storageModel = storageModel; + + this.taskModel = new TaskModel(chatModel, this); } // utility diff --git a/src/Model/Files/taskModel.ts b/src/Model/Files/taskModel.ts index e21ca9a1..4b0d524d 100644 --- a/src/Model/Files/taskModel.ts +++ b/src/Model/Files/taskModel.ts @@ -1,20 +1,31 @@ // thile file is responsible for managing task files within chats. -import { FileContent } from "./fileModel"; +import FileModel, { FileContent } from "./fileModel"; -export default class TaskFileModel {} +import ChatModel from "../Chat/chatModel"; + +export default class TaskModel { + chatModel: ChatModel; + fileModel: FileModel; + + // init + constructor(chatModel: ChatModel, fileModel: FileModel) { + this.chatModel = chatModel; + this.fileModel = fileModel; + } +} // types export interface TaskFileContent extends FileContent { - type: "task", + type: "task"; - board: string; - category?: string; - status?: string; + board: string; + category?: string; + status?: string; - description?: string; - - priority?: number; - date?: string; - time?: string; -} \ No newline at end of file + description?: string; + + priority?: number; + date?: string; + time?: string; +}