integrate TaskModel with FileModel
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
// 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;
|
||||
|
||||
Reference in New Issue
Block a user