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 { 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
|
||||||
|
|||||||
@@ -1,12 +1,23 @@
|
|||||||
// 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;
|
||||||
|
|||||||
Reference in New Issue
Block a user