rename all enums to plural

This commit is contained in:
marlon-erler
2026-04-08 14:02:12 +00:00
parent b0537ae3a4
commit ad513fd1bb
25 changed files with 132 additions and 132 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import ChatModel, { ChatMessage } from "./chatModel";
import StorageModel, {
StorageModelSubPath,
StorageModelSubPaths,
filePaths,
} from "../Global/storageModel";
@@ -81,7 +81,7 @@ export default class ChatListModel {
// load
loadChats = (): void => {
const chatDir = StorageModel.getPath(
StorageModelSubPath.Chat,
StorageModelSubPaths.Chat,
filePaths.chat.base,
);
const chatIds = this.storageModel.list(chatDir);
+16 -16
View File
@@ -15,13 +15,13 @@ import {
stringify,
} from "../Utility/utility";
import StorageModel, {
StorageModelSubPath,
StorageModelSubPaths,
filePaths,
} from "../Global/storageModel";
import { decryptString, encryptString } from "../Utility/crypto";
import ChatListModel from "./chatListModel";
import { Color } from "../../colors";
import { Colors } from "../../colors";
import ConnectionModel from "../Global/connectionModel";
import SettingsModel from "../Global/settingsModel";
import { v4 } from "uuid";
@@ -37,7 +37,7 @@ export default class ChatModel {
// data
id: string;
info: ChatInfo;
color: Color;
color: Colors;
chatMessageHandlerManager: HandlerManager<ChatMessage> =
new HandlerManager();
@@ -51,28 +51,28 @@ export default class ChatModel {
// paths
getBasePath = (): string[] => {
return StorageModel.getPath(
StorageModelSubPath.Chat,
StorageModelSubPaths.Chat,
filePaths.chat.chatBase(this.id),
);
};
getInfoPath = (): string[] => {
return StorageModel.getPath(
StorageModelSubPath.Chat,
StorageModelSubPaths.Chat,
filePaths.chat.info(this.id),
);
};
getColorPath = (): string[] => {
return StorageModel.getPath(
StorageModelSubPath.Chat,
StorageModelSubPaths.Chat,
filePaths.chat.color(this.id),
);
};
getMessageDirPath = (): string[] => {
return StorageModel.getPath(
StorageModelSubPath.Chat,
StorageModelSubPaths.Chat,
filePaths.chat.messages(this.id),
);
};
@@ -83,7 +83,7 @@ export default class ChatModel {
getReactionDirPath = (): string[] => {
return StorageModel.getPath(
StorageModelSubPath.Chat,
StorageModelSubPaths.Chat,
filePaths.chat.reactions(this.id),
);
};
@@ -100,7 +100,7 @@ export default class ChatModel {
);
if (chatMessage == null) return;
chatMessage.status = ChatMessageStatus.Received;
chatMessage.status = ChatMessageStatuses.Received;
this.addMessage(chatMessage);
this.setReadStatus(true);
@@ -123,7 +123,7 @@ export default class ChatModel {
};
handleMessageSent = (chatMessage: ChatMessage): void => {
chatMessage.status = ChatMessageStatus.Sent;
chatMessage.status = ChatMessageStatuses.Sent;
this.addMessage(chatMessage);
};
@@ -144,7 +144,7 @@ export default class ChatModel {
this.storeInfo();
};
setColor = (color: Color): void => {
setColor = (color: Colors): void => {
this.color = color;
this.storeColor();
};
@@ -277,7 +277,7 @@ export default class ChatModel {
const path: string[] = this.getColorPath();
const color: string | null = this.storageModel.read(path);
if (!color) {
this.color = Color.Standard;
this.color = Colors.Standard;
} else {
this.color = color as any;
}
@@ -386,7 +386,7 @@ export default class ChatModel {
body,
dateSent: createTimestamp(),
status: ChatMessageStatus.Outbox,
status: ChatMessageStatuses.Outbox,
stringifiedFile: "",
};
if (fileContent != undefined) {
@@ -455,7 +455,7 @@ export interface ChatInfo extends ValidObject {
hasUnreadMessages: boolean;
}
export enum ChatMessageStatus {
export enum ChatMessageStatuses {
Outbox = "outbox",
Sent = "sent",
Received = "received",
@@ -470,7 +470,7 @@ export interface ChatMessage extends ValidObject {
body: string;
dateSent: string;
status: ChatMessageStatus;
status: ChatMessageStatuses;
stringifiedFile: string;
}
@@ -504,7 +504,7 @@ export const ChatMessageReference: ChatMessage = {
body: "",
dateSent: "",
status: "" as ChatMessageStatus,
status: "" as ChatMessageStatuses,
stringifiedFile: "",
};
+5 -5
View File
@@ -8,7 +8,7 @@ import FileModel, { FileContent, FileModelSubPath } from "./fileModel";
import CalendarModel from "./calendarModel";
import ChatModel from "../Chat/chatModel";
import { Color } from "../../colors";
import { Colors } from "../../colors";
import { HandlerManager } from "../Utility/utility";
import SettingsModel from "../Global/settingsModel";
import StorageModel from "../Global/storageModel";
@@ -96,7 +96,7 @@ export default class BoardsAndTasksModel {
BoardsAndTasksModel.createBoardInfoFileContent(
v4(),
name,
Color.Standard,
Colors.Standard,
);
return boardInfoFileContent;
};
@@ -256,7 +256,7 @@ export default class BoardsAndTasksModel {
static createBoardInfoFileContent = (
fileId: string,
name: string,
color: Color,
color: Colors,
): BoardInfoFileContent => {
const fileContent: FileContent<"board-info"> =
FileModel.createFileContent(fileId, "board-info");
@@ -294,7 +294,7 @@ export enum TaskModelSubPaths {
// types
export interface BoardInfoFileContent extends FileContent<"board-info"> {
name: string;
color: Color;
color: Colors;
}
export interface TaskFileContent extends FileContent<"task"> {
@@ -322,7 +322,7 @@ export const BoardInfoFileContentReference: BoardInfoFileContent = {
type: "board-info",
name: "",
color: "" as Color,
color: "" as Colors,
};
export const TaskFileContentReference: TaskFileContent = {
+2 -2
View File
@@ -2,7 +2,7 @@
import { DATA_VERSION, ValidObject } from "../Utility/typeSafety";
import StorageModel, {
StorageModelSubPath,
StorageModelSubPaths,
filePaths,
} from "../Global/storageModel";
import {
@@ -27,7 +27,7 @@ export default class FileModel {
// paths
getBasePath = (): string[] => {
return StorageModel.getPath(
StorageModelSubPath.Chat,
StorageModelSubPaths.Chat,
filePaths.chat.files(this.chatModel.id),
);
};
+6 -6
View File
@@ -2,7 +2,7 @@
import { ChatMessage, ChatMessageReference } from "../Chat/chatModel";
import { HandlerManager, stringify } from "../Utility/utility";
import StorageModel, { StorageModelSubPath, filePaths } from "./storageModel";
import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
import UDNFrontend, { Message } from "udn-frontend";
export default class ConnectionModel {
@@ -55,7 +55,7 @@ export default class ConnectionModel {
// do not reconnect
const reconnectAddressPath: string[] = StorageModel.getPath(
StorageModelSubPath.ConnectionModel,
StorageModelSubPaths.ConnectionModel,
filePaths.connectionModel.reconnectAddress,
);
this.storageModel.remove(reconnectAddressPath);
@@ -74,7 +74,7 @@ export default class ConnectionModel {
// mailbox
getMailboxPath = (address: string): string[] => {
const mailboxDirPath = StorageModel.getPath(
StorageModelSubPath.ConnectionModel,
StorageModelSubPaths.ConnectionModel,
filePaths.connectionModel.mailboxes,
);
const mailboxFilePath = [...mailboxDirPath, address];
@@ -122,7 +122,7 @@ export default class ConnectionModel {
// outbox
getOutboxPath = (): string[] => {
return StorageModel.getPath(
StorageModelSubPath.ConnectionModel,
StorageModelSubPaths.ConnectionModel,
filePaths.connectionModel.outbox,
);
};
@@ -192,7 +192,7 @@ export default class ConnectionModel {
// storage
getPreviousAddressPath = (): string[] => {
return StorageModel.getPath(
StorageModelSubPath.ConnectionModel,
StorageModelSubPaths.ConnectionModel,
filePaths.connectionModel.previousAddresses,
);
};
@@ -204,7 +204,7 @@ export default class ConnectionModel {
getReconnectAddressPath = (): string[] => {
return StorageModel.getPath(
StorageModelSubPath.ConnectionModel,
StorageModelSubPaths.ConnectionModel,
filePaths.connectionModel.reconnectAddress,
);
};
+5 -5
View File
@@ -1,6 +1,6 @@
// this file is responsible for all settings.
import StorageModel, { StorageModelSubPath, filePaths } from "./storageModel";
import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
export default class SettingsModel {
storageModel: StorageModel;
@@ -13,7 +13,7 @@ export default class SettingsModel {
setName(newValue: string): void {
this.username = newValue;
const path = StorageModel.getPath(
StorageModelSubPath.SettingsModel,
StorageModelSubPaths.SettingsModel,
filePaths.settingsModel.username,
);
this.storageModel.write(path, newValue);
@@ -22,7 +22,7 @@ export default class SettingsModel {
setFirstDayOfWeek(newValue: string): void {
this.firstDayOfWeek = newValue;
const path = StorageModel.getPath(
StorageModelSubPath.SettingsModel,
StorageModelSubPaths.SettingsModel,
filePaths.settingsModel.firstDayOfWeek,
);
this.storageModel.write(path, newValue);
@@ -31,7 +31,7 @@ export default class SettingsModel {
// load
loadUsernam(): void {
const path = StorageModel.getPath(
StorageModelSubPath.SettingsModel,
StorageModelSubPaths.SettingsModel,
filePaths.settingsModel.username,
);
const content = this.storageModel.read(path);
@@ -40,7 +40,7 @@ export default class SettingsModel {
loadFirstDayofWeek(): void {
const path = StorageModel.getPath(
StorageModelSubPath.SettingsModel,
StorageModelSubPaths.SettingsModel,
filePaths.settingsModel.firstDayOfWeek,
);
const content = this.storageModel.read(path);
+2 -2
View File
@@ -212,7 +212,7 @@ export default class StorageModel {
};
static getPath(
locationName: StorageModelSubPath,
locationName: StorageModelSubPaths,
filePath: string[],
): string[] {
return [DATA_VERSION, locationName, ...filePath];
@@ -223,7 +223,7 @@ export default class StorageModel {
export type StorageEntry = { [key: string]: StorageEntry };
// locations
export enum StorageModelSubPath {
export enum StorageModelSubPaths {
Chat = "chat",
ConnectionModel = "connection",