remodel tasks and boards
This commit is contained in:
Vendored
+93
-66
@@ -487,6 +487,18 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// src/ViewModel/colors.ts
|
||||||
|
var Color = /* @__PURE__ */ ((Color2) => {
|
||||||
|
Color2["Standard"] = "standard";
|
||||||
|
Color2["Coral"] = "coral";
|
||||||
|
Color2["Yellow"] = "yellow";
|
||||||
|
Color2["Mint"] = "mint";
|
||||||
|
Color2["LightBlue"] = "lightblue";
|
||||||
|
Color2["Blue"] = "blue";
|
||||||
|
Color2["purple"] = "purple";
|
||||||
|
return Color2;
|
||||||
|
})(Color || {});
|
||||||
|
|
||||||
// src/Model/Files/taskModel.ts
|
// src/Model/Files/taskModel.ts
|
||||||
var TaskModel = class _TaskModel {
|
var TaskModel = class _TaskModel {
|
||||||
storageModel;
|
storageModel;
|
||||||
@@ -505,61 +517,50 @@
|
|||||||
getBoardDirPath = () => {
|
getBoardDirPath = () => {
|
||||||
return [...this.getBasePath(), subDirectories.boards];
|
return [...this.getBasePath(), subDirectories.boards];
|
||||||
};
|
};
|
||||||
getBoardPath = (boardName) => {
|
getBoardPath = (boardId) => {
|
||||||
return [...this.getBoardDirPath(), boardName];
|
return [...this.getBoardDirPath(), boardId];
|
||||||
};
|
};
|
||||||
getTaskPath = (boardName, fileId) => {
|
getBoardInfoPath = (boardId) => {
|
||||||
return [...this.getBoardPath(boardName), fileId];
|
return [...this.getBoardPath(boardId), subDirectories.boardInfo];
|
||||||
};
|
};
|
||||||
getTaskContentPath = (boardName, fileId, contentName) => {
|
getTaskDirPath = (boardId) => {
|
||||||
return [...this.getTaskPath(boardName, fileId), contentName];
|
return [...this.getBoardPath(boardId), subDirectories.boardTasks];
|
||||||
|
};
|
||||||
|
getTaskPath = (boardId, fileId) => {
|
||||||
|
return [...this.getTaskDirPath(boardId), fileId];
|
||||||
|
};
|
||||||
|
getTaskContentPath = (boardId, fileId, contentName) => {
|
||||||
|
return [...this.getTaskPath(boardId, fileId), contentName];
|
||||||
};
|
};
|
||||||
// handler
|
// handler
|
||||||
handleTaskFileContent = (file, fileContent) => {
|
handleFileContent = (file, fileContent) => {
|
||||||
if (checkMatchesObjectStructure(fileContent, TaskFileContentReference) == false)
|
if (checkMatchesObjectStructure(fileContent, BoardInfoFileContentReference) == true) {
|
||||||
return;
|
} else if (checkMatchesObjectStructure(fileContent, TaskFileContentReference) == true) {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// methods
|
// boards
|
||||||
createTask = (board, name) => {
|
createBoard = (name) => {
|
||||||
const file = FileModel.createFile();
|
const file = FileModel.createFile();
|
||||||
const taskFileContent = _TaskModel.createTaskFileContent(
|
const boardInfoFileContent = _TaskModel.createBoardInfoFileContent(name, "standard" /* Standard */);
|
||||||
board,
|
this.fileModel.addOrUpdateFile(file, boardInfoFileContent);
|
||||||
name
|
|
||||||
);
|
|
||||||
this.saveTask(file, taskFileContent);
|
|
||||||
};
|
};
|
||||||
saveTask = (file, newTaskFileContent) => {
|
listBoardIds = () => {
|
||||||
file.contentVersions.add(newTaskFileContent);
|
|
||||||
this.fileModel.addOrUpdateFile(file);
|
|
||||||
};
|
|
||||||
// locations
|
|
||||||
getTaskLocation = (file) => {
|
|
||||||
const locationPath = this.getTaskLocationPath(file.id);
|
|
||||||
const locationOrNull = this.storageModel.readStringifiable(locationPath, TaskLocationReference);
|
|
||||||
return locationOrNull;
|
|
||||||
};
|
|
||||||
storeTaskLocation = (file, taskLocation) => {
|
|
||||||
const locationPath = this.getTaskLocationPath(file.id);
|
|
||||||
this.storageModel.writeStringifiable(locationPath, taskLocation);
|
|
||||||
};
|
|
||||||
updateTaskLocation = (file, newLocation) => {
|
|
||||||
const previousLocation = this.getTaskLocation(file);
|
|
||||||
if (previousLocation == null) return false;
|
|
||||||
const oldBoardName = previousLocation.board;
|
|
||||||
const sourcePath = this.getTaskPath(oldBoardName, file.id);
|
|
||||||
const newBoardName = newLocation.board;
|
|
||||||
const destinationPath = this.getTaskPath(newBoardName, file.id);
|
|
||||||
return this.storageModel.rename(sourcePath, destinationPath);
|
|
||||||
};
|
|
||||||
// storage
|
|
||||||
listBoardsNames = () => {
|
|
||||||
const boardDirPath = this.getBoardDirPath();
|
const boardDirPath = this.getBoardDirPath();
|
||||||
const boardNames = this.storageModel.list(boardDirPath);
|
const boardNames = this.storageModel.list(boardDirPath);
|
||||||
return boardNames;
|
return boardNames;
|
||||||
};
|
};
|
||||||
listFileIdsOfBoard = (boardName) => {
|
//tasks
|
||||||
const boardPath = this.getBoardPath(boardName);
|
createTask = (boardId, name) => {
|
||||||
const fileIds = this.storageModel.list(boardPath);
|
const file = FileModel.createFile();
|
||||||
|
const taskFileContent = _TaskModel.createTaskFileContent(
|
||||||
|
boardId,
|
||||||
|
name
|
||||||
|
);
|
||||||
|
this.fileModel.addOrUpdateFile(file, taskFileContent);
|
||||||
|
};
|
||||||
|
listTaskIds = (boardName) => {
|
||||||
|
const getTaskDirPath = this.getTaskDirPath(boardName);
|
||||||
|
const fileIds = this.storageModel.list(getTaskDirPath);
|
||||||
return fileIds;
|
return fileIds;
|
||||||
};
|
};
|
||||||
getTaskVersionNames = (boardName, fileId) => {
|
getTaskVersionNames = (boardName, fileId) => {
|
||||||
@@ -579,6 +580,25 @@
|
|||||||
);
|
);
|
||||||
return taskFileContentOrNull;
|
return taskFileContentOrNull;
|
||||||
};
|
};
|
||||||
|
// locations
|
||||||
|
getTaskLocation = (file) => {
|
||||||
|
const locationPath = this.getTaskLocationPath(file.id);
|
||||||
|
const locationOrNull = this.storageModel.readStringifiable(locationPath, TaskLocationReference);
|
||||||
|
return locationOrNull;
|
||||||
|
};
|
||||||
|
storeTaskLocation = (file, taskLocation) => {
|
||||||
|
const locationPath = this.getTaskLocationPath(file.id);
|
||||||
|
this.storageModel.writeStringifiable(locationPath, taskLocation);
|
||||||
|
};
|
||||||
|
updateTaskLocation = (file, newLocation) => {
|
||||||
|
const previousLocation = this.getTaskLocation(file);
|
||||||
|
if (previousLocation == null) return false;
|
||||||
|
const oldBoardName = previousLocation.boardId;
|
||||||
|
const sourcePath = this.getTaskPath(oldBoardName, file.id);
|
||||||
|
const newBoardName = newLocation.boardId;
|
||||||
|
const destinationPath = this.getTaskPath(newBoardName, file.id);
|
||||||
|
return this.storageModel.rename(sourcePath, destinationPath);
|
||||||
|
};
|
||||||
// init
|
// init
|
||||||
constructor(storageModel2, chatModel, fileModel) {
|
constructor(storageModel2, chatModel, fileModel) {
|
||||||
this.chatModel = chatModel;
|
this.chatModel = chatModel;
|
||||||
@@ -586,18 +606,36 @@
|
|||||||
this.storageModel = storageModel2;
|
this.storageModel = storageModel2;
|
||||||
}
|
}
|
||||||
// utility
|
// utility
|
||||||
static createTaskFileContent = (name, board) => {
|
static createBoardInfoFileContent = (name, color) => {
|
||||||
|
const fileContent = FileModel.createFileContent("board");
|
||||||
|
return {
|
||||||
|
...fileContent,
|
||||||
|
name,
|
||||||
|
color
|
||||||
|
};
|
||||||
|
};
|
||||||
|
static createTaskFileContent = (name, boardId) => {
|
||||||
const fileContent = FileModel.createFileContent("task");
|
const fileContent = FileModel.createFileContent("task");
|
||||||
return {
|
return {
|
||||||
...fileContent,
|
...fileContent,
|
||||||
name,
|
name,
|
||||||
board
|
boardId
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
var subDirectories = {
|
var subDirectories = {
|
||||||
locations: "locations",
|
locations: "locations",
|
||||||
boards: "boards"
|
boards: "boards",
|
||||||
|
boardInfo: "info",
|
||||||
|
boardTasks: "tasks"
|
||||||
|
};
|
||||||
|
var BoardInfoFileContentReference = {
|
||||||
|
dataVersion: DATA_VERSION,
|
||||||
|
id: "",
|
||||||
|
creationDate: "",
|
||||||
|
type: "board",
|
||||||
|
name: "",
|
||||||
|
color: ""
|
||||||
};
|
};
|
||||||
var TaskFileContentReference = {
|
var TaskFileContentReference = {
|
||||||
dataVersion: DATA_VERSION,
|
dataVersion: DATA_VERSION,
|
||||||
@@ -605,11 +643,11 @@
|
|||||||
creationDate: "",
|
creationDate: "",
|
||||||
type: "task",
|
type: "task",
|
||||||
name: "",
|
name: "",
|
||||||
board: ""
|
boardId: ""
|
||||||
};
|
};
|
||||||
var TaskLocationReference = {
|
var TaskLocationReference = {
|
||||||
dataVersion: DATA_VERSION,
|
dataVersion: DATA_VERSION,
|
||||||
board: ""
|
boardId: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
// src/Model/Files/fileModel.ts
|
// src/Model/Files/fileModel.ts
|
||||||
@@ -643,12 +681,13 @@
|
|||||||
handleFileAndClearContents = (file) => {
|
handleFileAndClearContents = (file) => {
|
||||||
for (const fileContent of file.contentVersions) {
|
for (const fileContent of file.contentVersions) {
|
||||||
this.storeFileContent(file, fileContent);
|
this.storeFileContent(file, fileContent);
|
||||||
this.taskModel.handleTaskFileContent(file, fileContent);
|
this.taskModel.handleFileContent(file, fileContent);
|
||||||
file.contentVersions.delete(fileContent);
|
|
||||||
}
|
}
|
||||||
|
file.contentVersions = [];
|
||||||
};
|
};
|
||||||
// methods
|
// methods
|
||||||
addOrUpdateFile = (file) => {
|
addOrUpdateFile = (file, fileContent) => {
|
||||||
|
file.contentVersions.push(fileContent);
|
||||||
this.chatModel.sendMessage("", file);
|
this.chatModel.sendMessage("", file);
|
||||||
this.handleFileAndClearContents(file);
|
this.handleFileAndClearContents(file);
|
||||||
};
|
};
|
||||||
@@ -701,7 +740,7 @@
|
|||||||
return {
|
return {
|
||||||
dataVersion: DATA_VERSION,
|
dataVersion: DATA_VERSION,
|
||||||
id: v4_default(),
|
id: v4_default(),
|
||||||
contentVersions: /* @__PURE__ */ new Set()
|
contentVersions: []
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static createFileContent = (type) => {
|
static createFileContent = (type) => {
|
||||||
@@ -722,7 +761,7 @@
|
|||||||
var FileReference = {
|
var FileReference = {
|
||||||
dataVersion: DATA_VERSION,
|
dataVersion: DATA_VERSION,
|
||||||
id: "",
|
id: "",
|
||||||
contentVersions: /* @__PURE__ */ new Set([FileContentReference2])
|
contentVersions: [FileContentReference2]
|
||||||
};
|
};
|
||||||
|
|
||||||
// src/Model/Utility/crypto.ts
|
// src/Model/Utility/crypto.ts
|
||||||
@@ -798,18 +837,6 @@
|
|||||||
return new Uint8Array(array);
|
return new Uint8Array(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
// src/ViewModel/colors.ts
|
|
||||||
var Color = /* @__PURE__ */ ((Color2) => {
|
|
||||||
Color2["Standard"] = "standard";
|
|
||||||
Color2["Coral"] = "coral";
|
|
||||||
Color2["Yellow"] = "yellow";
|
|
||||||
Color2["Mint"] = "mint";
|
|
||||||
Color2["LightBlue"] = "lightblue";
|
|
||||||
Color2["Blue"] = "blue";
|
|
||||||
Color2["purple"] = "purple";
|
|
||||||
return Color2;
|
|
||||||
})(Color || {});
|
|
||||||
|
|
||||||
// src/Model/Chat/chatModel.ts
|
// src/Model/Chat/chatModel.ts
|
||||||
var ChatModel = class _ChatModel {
|
var ChatModel = class _ChatModel {
|
||||||
connectionModel;
|
connectionModel;
|
||||||
|
|||||||
@@ -52,14 +52,15 @@ export default class FileModel {
|
|||||||
handleFileAndClearContents = (file: File): void => {
|
handleFileAndClearContents = (file: File): void => {
|
||||||
for (const fileContent of file.contentVersions) {
|
for (const fileContent of file.contentVersions) {
|
||||||
this.storeFileContent(file, fileContent);
|
this.storeFileContent(file, fileContent);
|
||||||
this.taskModel.handleTaskFileContent(file, fileContent);
|
this.taskModel.handleFileContent(file, fileContent);
|
||||||
|
|
||||||
file.contentVersions.delete(fileContent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file.contentVersions = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
addOrUpdateFile = (file: File): void => {
|
addOrUpdateFile = (file: File, fileContent: FileContent<string>): void => {
|
||||||
|
file.contentVersions.push(fileContent);
|
||||||
this.chatModel.sendMessage("", file);
|
this.chatModel.sendMessage("", file);
|
||||||
this.handleFileAndClearContents(file);
|
this.handleFileAndClearContents(file);
|
||||||
};
|
};
|
||||||
@@ -131,7 +132,7 @@ export default class FileModel {
|
|||||||
dataVersion: DATA_VERSION,
|
dataVersion: DATA_VERSION,
|
||||||
|
|
||||||
id: v4(),
|
id: v4(),
|
||||||
contentVersions: new Set(),
|
contentVersions: [],
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -154,7 +155,7 @@ export const modelDirectories = {
|
|||||||
// types
|
// types
|
||||||
export interface File extends ValidObject {
|
export interface File extends ValidObject {
|
||||||
id: string;
|
id: string;
|
||||||
contentVersions: Set<FileContent<string>>;
|
contentVersions: FileContent<string>[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FileContent<T extends string> extends ValidObject {
|
export interface FileContent<T extends string> extends ValidObject {
|
||||||
@@ -177,5 +178,5 @@ export const FileReference: File = {
|
|||||||
dataVersion: DATA_VERSION,
|
dataVersion: DATA_VERSION,
|
||||||
|
|
||||||
id: "",
|
id: "",
|
||||||
contentVersions: new Set([FileContentReference]),
|
contentVersions: [FileContentReference],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import FileModel, {
|
|||||||
} from "./fileModel";
|
} from "./fileModel";
|
||||||
|
|
||||||
import ChatModel from "../Chat/chatModel";
|
import ChatModel from "../Chat/chatModel";
|
||||||
|
import { Color } from "../../ViewModel/colors";
|
||||||
import StorageModel from "../Global/storageModel";
|
import StorageModel from "../Global/storageModel";
|
||||||
|
|
||||||
export default class TaskModel {
|
export default class TaskModel {
|
||||||
@@ -36,87 +37,81 @@ export default class TaskModel {
|
|||||||
return [...this.getBasePath(), subDirectories.boards];
|
return [...this.getBasePath(), subDirectories.boards];
|
||||||
};
|
};
|
||||||
|
|
||||||
getBoardPath = (boardName: string): string[] => {
|
getBoardPath = (boardId: string): string[] => {
|
||||||
return [...this.getBoardDirPath(), boardName];
|
return [...this.getBoardDirPath(), boardId];
|
||||||
};
|
};
|
||||||
|
|
||||||
getTaskPath = (boardName: string, fileId: string): string[] => {
|
getBoardInfoPath = (boardId: string): string[] => {
|
||||||
return [...this.getBoardPath(boardName), fileId];
|
return [...this.getBoardPath(boardId), subDirectories.boardInfo];
|
||||||
|
};
|
||||||
|
|
||||||
|
getTaskDirPath = (boardId: string): string[] => {
|
||||||
|
return [...this.getBoardPath(boardId), subDirectories.boardTasks];
|
||||||
|
};
|
||||||
|
|
||||||
|
getTaskPath = (boardId: string, fileId: string): string[] => {
|
||||||
|
return [...this.getTaskDirPath(boardId), fileId];
|
||||||
};
|
};
|
||||||
|
|
||||||
getTaskContentPath = (
|
getTaskContentPath = (
|
||||||
boardName: string,
|
boardId: string,
|
||||||
fileId: string,
|
fileId: string,
|
||||||
contentName
|
contentName: string
|
||||||
): string[] => {
|
): string[] => {
|
||||||
return [...this.getTaskPath(boardName, fileId), contentName];
|
return [...this.getTaskPath(boardId, fileId), contentName];
|
||||||
};
|
};
|
||||||
|
|
||||||
// handler
|
// handler
|
||||||
handleTaskFileContent = (
|
handleFileContent = (file: File, fileContent: FileContent<string>): void => {
|
||||||
file: File,
|
|
||||||
fileContent: FileContent<string>
|
|
||||||
): void => {
|
|
||||||
if (
|
if (
|
||||||
checkMatchesObjectStructure(fileContent, TaskFileContentReference) ==
|
checkMatchesObjectStructure(fileContent, BoardInfoFileContentReference) ==
|
||||||
false
|
true
|
||||||
)
|
) {
|
||||||
return;
|
// todo
|
||||||
|
} else if (
|
||||||
// TODO handle
|
checkMatchesObjectStructure(fileContent, TaskFileContentReference) == true
|
||||||
|
) {
|
||||||
|
// todo
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// methods
|
// boards
|
||||||
createTask = (board: string, name: string): void => {
|
createBoard = (name: string): void => {
|
||||||
const file: File = FileModel.createFile();
|
const file: File = FileModel.createFile();
|
||||||
const taskFileContent: TaskFileContent = TaskModel.createTaskFileContent(
|
const boardInfoFileContent: BoardInfoFileContent =
|
||||||
board,
|
TaskModel.createBoardInfoFileContent(name, Color.Standard);
|
||||||
name
|
this.fileModel.addOrUpdateFile(file, boardInfoFileContent);
|
||||||
);
|
|
||||||
this.saveTask(file, taskFileContent);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
saveTask = (file: File, newTaskFileContent: TaskFileContent): void => {
|
listBoardIds = (): string[] => {
|
||||||
file.contentVersions.add(newTaskFileContent);
|
|
||||||
this.fileModel.addOrUpdateFile(file);
|
|
||||||
};
|
|
||||||
|
|
||||||
// locations
|
|
||||||
getTaskLocation = (file: File): TaskLocation | null => {
|
|
||||||
const locationPath: string[] = this.getTaskLocationPath(file.id);
|
|
||||||
const locationOrNull: TaskLocation | null =
|
|
||||||
this.storageModel.readStringifiable(locationPath, TaskLocationReference);
|
|
||||||
return locationOrNull;
|
|
||||||
};
|
|
||||||
|
|
||||||
storeTaskLocation = (file: File, taskLocation: TaskLocation): void => {
|
|
||||||
const locationPath: string[] = this.getTaskLocationPath(file.id);
|
|
||||||
this.storageModel.writeStringifiable(locationPath, taskLocation);
|
|
||||||
};
|
|
||||||
|
|
||||||
updateTaskLocation = (file: File, newLocation: TaskLocation): boolean => {
|
|
||||||
const previousLocation: TaskLocation | null = this.getTaskLocation(file);
|
|
||||||
if (previousLocation == null) return false;
|
|
||||||
|
|
||||||
const oldBoardName: string = previousLocation.board;
|
|
||||||
const sourcePath: string[] = this.getTaskPath(oldBoardName, file.id);
|
|
||||||
|
|
||||||
const newBoardName: string = newLocation.board;
|
|
||||||
const destinationPath: string[] = this.getTaskPath(newBoardName, file.id);
|
|
||||||
|
|
||||||
return this.storageModel.rename(sourcePath, destinationPath);
|
|
||||||
};
|
|
||||||
|
|
||||||
// storage
|
|
||||||
listBoardsNames = (): string[] => {
|
|
||||||
const boardDirPath: string[] = this.getBoardDirPath();
|
const boardDirPath: string[] = this.getBoardDirPath();
|
||||||
const boardNames: string[] = this.storageModel.list(boardDirPath);
|
const boardNames: string[] = this.storageModel.list(boardDirPath);
|
||||||
return boardNames;
|
return boardNames;
|
||||||
};
|
};
|
||||||
|
|
||||||
listFileIdsOfBoard = (boardName: string): string[] => {
|
getBoardInfo = (boardId: string): BoardInfoFileContent | null => {
|
||||||
const boardPath: string[] = this.getBoardPath(boardName);
|
const boardInfoPath: string[] = this.getBoardInfoPath(boardId);
|
||||||
const fileIds: string[] = this.storageModel.list(boardPath);
|
const boardInfoFileContentOrNull: BoardInfoFileContent | null =
|
||||||
|
this.storageModel.readStringifiable(
|
||||||
|
boardInfoPath,
|
||||||
|
BoardInfoFileContentReference
|
||||||
|
);
|
||||||
|
return boardInfoFileContentOrNull;
|
||||||
|
};
|
||||||
|
|
||||||
|
//tasks
|
||||||
|
createTask = (boardId: string, name: string): void => {
|
||||||
|
const file: File = FileModel.createFile();
|
||||||
|
const taskFileContent: TaskFileContent = TaskModel.createTaskFileContent(
|
||||||
|
boardId,
|
||||||
|
name
|
||||||
|
);
|
||||||
|
this.fileModel.addOrUpdateFile(file, taskFileContent);
|
||||||
|
};
|
||||||
|
|
||||||
|
listTaskIds = (boardName: string): string[] => {
|
||||||
|
const getTaskDirPath: string[] = this.getTaskDirPath(boardName);
|
||||||
|
const fileIds: string[] = this.storageModel.list(getTaskDirPath);
|
||||||
return fileIds;
|
return fileIds;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -144,6 +139,12 @@ export default class TaskModel {
|
|||||||
return taskFileContentOrNull;
|
return taskFileContentOrNull;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
moveTask = (taskFileId: string, oldBoardId: string, newBoardId: string): boolean => {
|
||||||
|
const sourcePath: string[] = this.getTaskPath(oldBoardId, taskFileId);
|
||||||
|
const destinationPath: string[] = this.getTaskPath(newBoardId, taskFileId);
|
||||||
|
return this.storageModel.rename(sourcePath, destinationPath);
|
||||||
|
}
|
||||||
|
|
||||||
// init
|
// init
|
||||||
constructor(
|
constructor(
|
||||||
storageModel: StorageModel,
|
storageModel: StorageModel,
|
||||||
@@ -156,9 +157,23 @@ export default class TaskModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// utility
|
// utility
|
||||||
|
static createBoardInfoFileContent = (
|
||||||
|
name: string,
|
||||||
|
color: Color
|
||||||
|
): BoardInfoFileContent => {
|
||||||
|
const fileContent: FileContent<"board"> =
|
||||||
|
FileModel.createFileContent("board");
|
||||||
|
return {
|
||||||
|
...fileContent,
|
||||||
|
|
||||||
|
name,
|
||||||
|
color,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
static createTaskFileContent = (
|
static createTaskFileContent = (
|
||||||
name: string,
|
name: string,
|
||||||
board: string
|
boardId: string
|
||||||
): TaskFileContent => {
|
): TaskFileContent => {
|
||||||
const fileContent: FileContent<"task"> =
|
const fileContent: FileContent<"task"> =
|
||||||
FileModel.createFileContent("task");
|
FileModel.createFileContent("task");
|
||||||
@@ -166,7 +181,7 @@ export default class TaskModel {
|
|||||||
...fileContent,
|
...fileContent,
|
||||||
|
|
||||||
name,
|
name,
|
||||||
board,
|
boardId,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -174,12 +189,19 @@ export default class TaskModel {
|
|||||||
export const subDirectories = {
|
export const subDirectories = {
|
||||||
locations: "locations",
|
locations: "locations",
|
||||||
boards: "boards",
|
boards: "boards",
|
||||||
|
boardInfo: "info",
|
||||||
|
boardTasks: "tasks",
|
||||||
};
|
};
|
||||||
|
|
||||||
// types
|
// types
|
||||||
|
export interface BoardInfoFileContent extends FileContent<"board"> {
|
||||||
|
name: string;
|
||||||
|
color: Color;
|
||||||
|
}
|
||||||
|
|
||||||
export interface TaskFileContent extends FileContent<"task"> {
|
export interface TaskFileContent extends FileContent<"task"> {
|
||||||
name: string;
|
name: string;
|
||||||
board: string;
|
boardId: string;
|
||||||
|
|
||||||
category?: string;
|
category?: string;
|
||||||
status?: string;
|
status?: string;
|
||||||
@@ -191,11 +213,18 @@ export interface TaskFileContent extends FileContent<"task"> {
|
|||||||
time?: string;
|
time?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskLocation extends ValidObject {
|
|
||||||
board: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// reference
|
// reference
|
||||||
|
export const BoardInfoFileContentReference: BoardInfoFileContent = {
|
||||||
|
dataVersion: DATA_VERSION,
|
||||||
|
|
||||||
|
id: "",
|
||||||
|
creationDate: "",
|
||||||
|
type: "board",
|
||||||
|
|
||||||
|
name: "",
|
||||||
|
color: "" as Color,
|
||||||
|
};
|
||||||
|
|
||||||
export const TaskFileContentReference: TaskFileContent = {
|
export const TaskFileContentReference: TaskFileContent = {
|
||||||
dataVersion: DATA_VERSION,
|
dataVersion: DATA_VERSION,
|
||||||
|
|
||||||
@@ -204,11 +233,5 @@ export const TaskFileContentReference: TaskFileContent = {
|
|||||||
type: "task",
|
type: "task",
|
||||||
|
|
||||||
name: "",
|
name: "",
|
||||||
board: "",
|
boardId: "",
|
||||||
};
|
|
||||||
|
|
||||||
export const TaskLocationReference: TaskLocation = {
|
|
||||||
dataVersion: DATA_VERSION,
|
|
||||||
|
|
||||||
board: "",
|
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user