integrate TaskModel with FileModel

This commit is contained in:
marlon-erler
2024-07-22 02:16:58 +02:00
parent 5848de4c50
commit a776b977f8
2 changed files with 28 additions and 12 deletions
+5
View File
@@ -5,12 +5,15 @@ import StorageModel, { storageKeys } from "../Global/storageModel";
import { parseValidObject, stringify } from "../Utility/utility"; import { parseValidObject, stringify } from "../Utility/utility";
import ChatModel from "../Chat/chatModel"; import ChatModel from "../Chat/chatModel";
import TaskModel from "./taskModel";
import { v4 } from "uuid"; import { v4 } from "uuid";
export default class FileModel { export default class FileModel {
chatModel: ChatModel; chatModel: ChatModel;
storageModel: StorageModel; storageModel: StorageModel;
taskModel: TaskModel;
// handler // handler
handleStringifiedFile = (stringifiedFile: string): void => { handleStringifiedFile = (stringifiedFile: string): void => {
const file: File | null = parseValidObject(stringifiedFile, FileReference); const file: File | null = parseValidObject(stringifiedFile, FileReference);
@@ -83,6 +86,8 @@ export default class FileModel {
constructor(chatModel: ChatModel, storageModel: StorageModel) { constructor(chatModel: ChatModel, storageModel: StorageModel) {
this.chatModel = chatModel; this.chatModel = chatModel;
this.storageModel = storageModel; this.storageModel = storageModel;
this.taskModel = new TaskModel(chatModel, this);
} }
// utility // utility
+23 -12
View File
@@ -1,20 +1,31 @@
// thile file is responsible for managing task files within chats. // 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 // types
export interface TaskFileContent extends FileContent { export interface TaskFileContent extends FileContent {
type: "task", type: "task";
board: string; board: string;
category?: string; category?: string;
status?: string; status?: string;
description?: string; description?: string;
priority?: number; priority?: number;
date?: string; date?: string;
time?: string; time?: string;
} }