Step 2: Creating page Messages: userlist last messages + a page for all the messages received and sent.

This commit is contained in:
Paolo Arena
2019-10-27 00:39:00 +02:00
parent 4f895bdbe2
commit c95cded522
3 changed files with 411 additions and 0 deletions

82
src/model/MessageStore.ts Normal file
View File

@@ -0,0 +1,82 @@
import { EState } from './Calendar'
import { shared_consts } from '@src/common/shared_vuejs'
export interface IMessagePage {
show: boolean
msg: IMessage
state: EState
}
export interface ISource {
page?: string
event_id?: string
infoevent?: string
}
export interface IIdentity {
idapp?: string
username?: string
}
export const enum StatusMessage {
None = 0,
WaitingToSend = 1,
Sending = 2,
Sent = 3,
Received = 4,
Readit = 5
}
export const MsgDefault: IMessage = {
_id: '',
idapp: '',
source: {
event_id: '',
infoevent: '',
page: ''
},
origin: {
username: '',
idapp: ''
},
dest: {
idapp: '',
username: ''
},
message: '',
datemsg: new Date(),
read: false,
deleted: false,
status: StatusMessage.None
}
export interface IMessage {
_id?: any
idapp?: string
source?: ISource
origin?: IIdentity
dest?: IIdentity
message: string
datemsg?: Date
read?: boolean
deleted?: boolean
status?: StatusMessage
options?: number
}
export interface IChat {
username: string
lasttimeActive?: Date
}
export interface IMsgUsers {
username: string
msgs: IMessage[]
lastdataread?: Date
}
export interface IMessageState {
last_msgs: IMessage[]
users_msg: IMsgUsers[]
}