convert ChatInfo to satisfy FileContent ifc
This commit is contained in:
@@ -34,7 +34,7 @@ export default class ChatModel {
|
|||||||
|
|
||||||
// data
|
// data
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
info: ChatInfo; /* load function called in constructor */
|
info: ChatInfoFileContent; /* load function called in constructor */
|
||||||
color: Colors = Colors.Standard;
|
color: Colors = Colors.Standard;
|
||||||
|
|
||||||
get secondaryChannels(): string[] {
|
get secondaryChannels(): string[] {
|
||||||
@@ -278,7 +278,7 @@ export default class ChatModel {
|
|||||||
|
|
||||||
// load
|
// load
|
||||||
readonly loadInfo = (): void => {
|
readonly loadInfo = (): void => {
|
||||||
const info: ChatInfo | null = this.storageModel.readStringifiable(
|
const info: ChatInfoFileContent | null = this.storageModel.readStringifiable(
|
||||||
this.getInfoPath(),
|
this.getInfoPath(),
|
||||||
ChatInfoReference,
|
ChatInfoReference,
|
||||||
);
|
);
|
||||||
@@ -374,9 +374,11 @@ export default class ChatModel {
|
|||||||
return channelString.split("/");
|
return channelString.split("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
static generateChatInfo = (name: string, id: string): ChatInfo => {
|
static generateChatInfo = (name: string, id: string): ChatInfoFileContent => {
|
||||||
|
const file = FileModel.createFileContent(id, "chat-info");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dataVersion: DATA_VERSION,
|
...file,
|
||||||
|
|
||||||
name,
|
name,
|
||||||
secondaryChannels: [],
|
secondaryChannels: [],
|
||||||
@@ -464,7 +466,7 @@ export enum ReactionSymbols {
|
|||||||
Question = "❓",
|
Question = "❓",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChatInfo extends ValidObject {
|
export interface ChatInfoFileContent extends FileContent<"chat-info"> {
|
||||||
name: string;
|
name: string;
|
||||||
secondaryChannels: string[];
|
secondaryChannels: string[];
|
||||||
encryptionKey: string;
|
encryptionKey: string;
|
||||||
@@ -502,9 +504,15 @@ extends ValidObject, FileContent<"reaction"> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// references
|
// references
|
||||||
export const ChatInfoReference: ChatInfo = {
|
export const ChatInfoReference: ChatInfoFileContent = {
|
||||||
dataVersion: DATA_VERSION,
|
dataVersion: DATA_VERSION,
|
||||||
|
|
||||||
|
fileId: "",
|
||||||
|
fileContentId: "",
|
||||||
|
creationDate: "",
|
||||||
|
|
||||||
|
type: "chat-info",
|
||||||
|
|
||||||
name: "",
|
name: "",
|
||||||
secondaryChannels: [""],
|
secondaryChannels: [""],
|
||||||
encryptionKey: "",
|
encryptionKey: "",
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ export interface TaskFileContent extends FileContent<"task"> {
|
|||||||
export const BoardInfoFileContentReference: BoardInfoFileContent = {
|
export const BoardInfoFileContentReference: BoardInfoFileContent = {
|
||||||
dataVersion: DATA_VERSION,
|
dataVersion: DATA_VERSION,
|
||||||
|
|
||||||
fileId: "string",
|
fileId: "",
|
||||||
fileContentId: "",
|
fileContentId: "",
|
||||||
creationDate: "",
|
creationDate: "",
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user