From 7d388cf4eb049ceed7148cff408a7da390b61685 Mon Sep 17 00:00:00 2001 From: marlon-erler Date: Tue, 23 Jul 2024 18:23:26 +0200 Subject: [PATCH] cleanup, fixes with paths --- dist/index.js | 22 ++++++++-------------- src/Model/Files/fileModel.ts | 14 +++++++------- src/Model/Files/taskModel.ts | 17 ++++++++++------- src/ViewModel/Pages/taskPageViewModel.ts | 5 +++++ 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/dist/index.js b/dist/index.js index dc12934f..c65249fd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -576,7 +576,7 @@ boardHandlerManager = new HandlerManager(); // paths getBasePath = () => { - return this.fileModel.getModelContainerPath("taskModel"); + return this.fileModel.getModelContainerPath("tasks" /* ModelTask */); }; getBoardFilePath = (boardId) => { return [...this.fileModel.getFilePath(boardId)]; @@ -585,13 +585,16 @@ return [...this.fileModel.getFilePath(taskId)]; }; getBoardContainerPath = () => { - return [...this.getBasePath(), subDirectories.boards]; + return [...this.getBasePath(), "boards" /* Boards */]; }; getBoardDirectoryPath = (boardId) => { return [...this.getBoardContainerPath(), boardId]; }; getTaskContainerPath = (boardId) => { - return [...this.getBoardDirectoryPath(boardId), subDirectories.boardTasks]; + return [ + ...this.getBoardDirectoryPath(boardId), + "tasks" /* BoardTasks */ + ]; }; getTaskReferencePath = (boardId, fileId) => { return [...this.getTaskContainerPath(boardId), fileId]; @@ -714,10 +717,6 @@ }; }; }; - var subDirectories = { - boards: "boards", - boardTasks: "tasks" - }; var BoardInfoFileContentReference = { dataVersion: DATA_VERSION, fileId: "string", @@ -751,10 +750,10 @@ ); }; getFileContainerPath = () => { - return [...this.getBasePath(), subDirectories2.data]; + return [...this.getBasePath(), "data" /* Data */]; }; getModelContainerPath = (modelName) => { - return [...this.getBasePath(), subDirectories2.model, modelName]; + return [...this.getBasePath(), "model" /* Model */, modelName]; }; getFilePath = (fileId) => { return [...this.getFileContainerPath(), fileId]; @@ -846,11 +845,6 @@ }; }; }; - var subDirectories2 = { - data: "data", - model: "model", - taskModel: "tasks" - }; var FileContentReference = { dataVersion: DATA_VERSION, fileId: "", diff --git a/src/Model/Files/fileModel.ts b/src/Model/Files/fileModel.ts index 7076d98e..f010cd0e 100644 --- a/src/Model/Files/fileModel.ts +++ b/src/Model/Files/fileModel.ts @@ -30,13 +30,13 @@ export default class FileModel { }; getFileContainerPath = (): string[] => { - return [...this.getBasePath(), subDirectories.data]; + return [...this.getBasePath(), FileModelSubPath.Data]; }; getModelContainerPath = ( - modelName: keyof typeof subDirectories + modelName: FileModelSubPath ): string[] => { - return [...this.getBasePath(), subDirectories.model, modelName]; + return [...this.getBasePath(), FileModelSubPath.Model, modelName]; }; getFilePath = (fileId: string): string[] => { @@ -167,10 +167,10 @@ export default class FileModel { } // paths -export const subDirectories = { - data: "data", - model: "model", - taskModel: "tasks", +export enum FileModelSubPath { + Data = "data", + Model = "model", + ModelTask = "tasks", }; // types diff --git a/src/Model/Files/taskModel.ts b/src/Model/Files/taskModel.ts index 25327036..d5d42dc1 100644 --- a/src/Model/Files/taskModel.ts +++ b/src/Model/Files/taskModel.ts @@ -4,7 +4,7 @@ import { DATA_VERSION, checkMatchesObjectStructure, } from "../Utility/typeSafety"; -import FileModel, { FileContent } from "./fileModel"; +import FileModel, { FileContent, FileModelSubPath } from "./fileModel"; import ChatModel from "../Chat/chatModel"; import { Color } from "../../colors"; @@ -22,7 +22,7 @@ export default class TaskModel { // paths getBasePath = (): string[] => { - return this.fileModel.getModelContainerPath("taskModel"); + return this.fileModel.getModelContainerPath(FileModelSubPath.ModelTask); }; getBoardFilePath = (boardId: string): string[] => { @@ -34,7 +34,7 @@ export default class TaskModel { }; getBoardContainerPath = (): string[] => { - return [...this.getBasePath(), subDirectories.boards]; + return [...this.getBasePath(), TaskModelSubPaths.Boards]; }; getBoardDirectoryPath = (boardId: string): string[] => { @@ -42,7 +42,10 @@ export default class TaskModel { }; getTaskContainerPath = (boardId: string): string[] => { - return [...this.getBoardDirectoryPath(boardId), subDirectories.boardTasks]; + return [ + ...this.getBoardDirectoryPath(boardId), + TaskModelSubPaths.BoardTasks, + ]; }; getTaskReferencePath = (boardId: string, fileId: string): string[] => { @@ -215,9 +218,9 @@ export default class TaskModel { }; } -export const subDirectories = { - boards: "boards", - boardTasks: "tasks", +export enum TaskModelSubPaths { + Boards = "boards", + BoardTasks = "tasks", }; // types diff --git a/src/ViewModel/Pages/taskPageViewModel.ts b/src/ViewModel/Pages/taskPageViewModel.ts index bb4b7d7b..dc04af13 100644 --- a/src/ViewModel/Pages/taskPageViewModel.ts +++ b/src/ViewModel/Pages/taskPageViewModel.ts @@ -130,3 +130,8 @@ export default class TaskPageViewModel { ); } } + +export enum TaskPageViewModelSubPaths { + LastUsedBoard = "last-used-board", + BoardLastUsedView = "last-used-view", +}; \ No newline at end of file