add readonly keyword where applicable - AI
This commit is contained in:
@@ -10,12 +10,12 @@ import SettingsModel from "../Global/settingsModel";
|
||||
import { v4 } from "uuid";
|
||||
|
||||
export default class ChatListModel {
|
||||
storageModel: StorageModel;
|
||||
settingsModel: SettingsModel;
|
||||
connectionModel: ConnectionModel;
|
||||
readonly storageModel: StorageModel;
|
||||
readonly settingsModel: SettingsModel;
|
||||
readonly connectionModel: ConnectionModel;
|
||||
|
||||
// data
|
||||
chatModels: Set<ChatModel> = new Set<ChatModel>();
|
||||
chatModels = new Set<ChatModel>();
|
||||
|
||||
// handlers
|
||||
messageHandler = (data: Message): void => {
|
||||
|
||||
+14
-14
@@ -26,21 +26,21 @@ import SettingsModel from "../Global/settingsModel";
|
||||
import { v4 } from "uuid";
|
||||
|
||||
export default class ChatModel {
|
||||
connectionModel: ConnectionModel;
|
||||
storageModel: StorageModel;
|
||||
settingsModel: SettingsModel;
|
||||
chatListModel: ChatListModel;
|
||||
readonly connectionModel: ConnectionModel;
|
||||
readonly storageModel: StorageModel;
|
||||
readonly settingsModel: SettingsModel;
|
||||
readonly chatListModel: ChatListModel;
|
||||
|
||||
fileModel: FileModel;
|
||||
readonly fileModel: FileModel;
|
||||
|
||||
// data
|
||||
id: string;
|
||||
readonly id: string;
|
||||
info: ChatInfo;
|
||||
color: Colors;
|
||||
|
||||
chatMessageHandlerManager: HandlerManager<ChatMessage> =
|
||||
new HandlerManager();
|
||||
reactionHandlerManager: HandlerManager<ChatMessageReaction> =
|
||||
readonly reactionHandlerManager: HandlerManager<ChatMessageReaction> =
|
||||
new HandlerManager();
|
||||
|
||||
get secondaryChannels(): string[] {
|
||||
@@ -459,12 +459,12 @@ export enum ChatMessageStatuses {
|
||||
}
|
||||
|
||||
export interface ChatMessage extends ValidObject {
|
||||
id: string;
|
||||
readonly id: string;
|
||||
|
||||
channel: string;
|
||||
sender: string;
|
||||
readonly channel: string;
|
||||
readonly sender: string;
|
||||
body: string;
|
||||
dateSent: string;
|
||||
readonly dateSent: string;
|
||||
|
||||
status: ChatMessageStatuses;
|
||||
|
||||
@@ -473,9 +473,9 @@ export interface ChatMessage extends ValidObject {
|
||||
|
||||
export interface ChatMessageReaction
|
||||
extends ValidObject, FileContent<"reaction"> {
|
||||
messageId: string;
|
||||
sender: string;
|
||||
content: ReactionSymbols | string;
|
||||
readonly messageId: string;
|
||||
readonly sender: string;
|
||||
readonly content: ReactionSymbols | string;
|
||||
isDeleting: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,16 +15,16 @@ import StorageModel from "../Global/storageModel";
|
||||
import { v4 } from "uuid";
|
||||
|
||||
export default class BoardsAndTasksModel {
|
||||
storageModel: StorageModel;
|
||||
settingsModel: SettingsModel;
|
||||
chatModel: ChatModel;
|
||||
fileModel: FileModel;
|
||||
readonly storageModel: StorageModel;
|
||||
readonly settingsModel: SettingsModel;
|
||||
readonly chatModel: ChatModel;
|
||||
readonly fileModel: FileModel;
|
||||
|
||||
calendarModel: CalendarModel;
|
||||
readonly calendarModel: CalendarModel;
|
||||
|
||||
// data
|
||||
boardHandlerManager = new HandlerManager<BoardInfoFileContent>();
|
||||
taskHandlerManager = new HandlerManager<TaskFileContent>();
|
||||
readonly boardHandlerManager = new HandlerManager<BoardInfoFileContent>();
|
||||
readonly taskHandlerManager = new HandlerManager<TaskFileContent>();
|
||||
|
||||
// paths
|
||||
getBasePath = (): string[] => {
|
||||
|
||||
@@ -7,9 +7,9 @@ import StorageModel from "../Global/storageModel";
|
||||
import { TaskFileContent } from "./boardsAndTasksModel";
|
||||
|
||||
export default class CalendarModel {
|
||||
storageModel: StorageModel;
|
||||
fileModel: FileModel;
|
||||
settingsModel: SettingsModel;
|
||||
readonly storageModel: StorageModel;
|
||||
readonly fileModel: FileModel;
|
||||
readonly settingsModel: SettingsModel;
|
||||
|
||||
// paths
|
||||
getBasePath = (): string[] => {
|
||||
@@ -155,12 +155,12 @@ export enum CalendarModelSubPaths {
|
||||
|
||||
// types
|
||||
export interface MonthGrid<T> {
|
||||
offset: number;
|
||||
firstDayOfWeek: number;
|
||||
isCurrentMonth: boolean;
|
||||
readonly offset: number;
|
||||
readonly firstDayOfWeek: number;
|
||||
readonly isCurrentMonth: boolean;
|
||||
|
||||
year: number;
|
||||
month: number;
|
||||
readonly year: number;
|
||||
readonly month: number;
|
||||
|
||||
days: { [date: string]: T };
|
||||
readonly days: { [date: string]: T };
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@ import SettingsModel from "../Global/settingsModel";
|
||||
import { v4 } from "uuid";
|
||||
|
||||
export default class FileModel {
|
||||
storageModel: StorageModel;
|
||||
settingsModel: SettingsModel;
|
||||
readonly storageModel: StorageModel;
|
||||
readonly settingsModel: SettingsModel;
|
||||
|
||||
chatModel: ChatModel;
|
||||
boardsAndTasksModel: BoardsAndTasksModel;
|
||||
readonly chatModel: ChatModel;
|
||||
readonly boardsAndTasksModel: BoardsAndTasksModel;
|
||||
|
||||
// paths
|
||||
getBasePath = (): string[] => {
|
||||
@@ -193,11 +193,11 @@ export enum FileModelSubPath {
|
||||
// types
|
||||
export interface FileContent<T extends string>
|
||||
extends ValidObject, StringEntryObject {
|
||||
fileId: string;
|
||||
fileContentId: string;
|
||||
creationDate: string;
|
||||
readonly fileId: string;
|
||||
readonly fileContentId: string;
|
||||
readonly creationDate: string;
|
||||
|
||||
type: T;
|
||||
readonly type: T;
|
||||
}
|
||||
|
||||
// references
|
||||
|
||||
@@ -6,8 +6,8 @@ import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
|
||||
import UDNFrontend, { Message } from "udn-frontend";
|
||||
|
||||
export default class ConnectionModel {
|
||||
udn: UDNFrontend;
|
||||
storageModel: StorageModel;
|
||||
readonly udn: UDNFrontend;
|
||||
readonly storageModel: StorageModel;
|
||||
reconnectInterval: number | undefined = undefined;
|
||||
shouldAttemptReconnect: boolean = false;
|
||||
|
||||
@@ -20,10 +20,10 @@ export default class ConnectionModel {
|
||||
return this.udn.ws?.url;
|
||||
}
|
||||
|
||||
connectionChangeHandlerManager = new HandlerManager<void>();
|
||||
messageHandlerManager = new HandlerManager<Message>();
|
||||
messageSentHandlerManager = new HandlerManager<ChatMessage>();
|
||||
channelsToSubscribe = new Set<string>();
|
||||
readonly connectionChangeHandlerManager = new HandlerManager<void>();
|
||||
readonly messageHandlerManager = new HandlerManager<Message>();
|
||||
readonly messageSentHandlerManager = new HandlerManager<ChatMessage>();
|
||||
readonly channelsToSubscribe = new Set<string>();
|
||||
|
||||
// handlers
|
||||
handleMessage = (data: Message): void => {
|
||||
|
||||
@@ -14,15 +14,15 @@ import StorageModel from "./storageModel";
|
||||
import { checkMatchesObjectStructure } from "../Utility/typeSafety";
|
||||
|
||||
export default class FileTransferModel {
|
||||
storageModel: StorageModel;
|
||||
connectionModel: ConnectionModel;
|
||||
readonly storageModel: StorageModel;
|
||||
readonly connectionModel: ConnectionModel;
|
||||
|
||||
static READY_MESSAGE = "ready";
|
||||
|
||||
// data
|
||||
transferData: TransferData | undefined = undefined;
|
||||
fileHandlerManager = new HandlerManager<string>();
|
||||
readyToSendHandlerManager = new HandlerManager<boolean>();
|
||||
transferData: TransferData | undefined;
|
||||
readonly fileHandlerManager = new HandlerManager<string>();
|
||||
readonly readyToSendHandlerManager = new HandlerManager<boolean>();
|
||||
direction: TransferDirections = TransferDirections.Send;
|
||||
|
||||
// general
|
||||
@@ -140,8 +140,8 @@ export default class FileTransferModel {
|
||||
}
|
||||
|
||||
export interface TransferData {
|
||||
channel: string;
|
||||
key: string;
|
||||
readonly channel: string;
|
||||
readonly key: string;
|
||||
}
|
||||
|
||||
export interface FileData {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
|
||||
|
||||
export default class SettingsModel {
|
||||
storageModel: StorageModel;
|
||||
readonly storageModel: StorageModel;
|
||||
|
||||
// data
|
||||
username: string;
|
||||
|
||||
Reference in New Issue
Block a user