mirror of https://github.com/msgbyte/tailchat
				
				
				
			refactor: unified messaging inbox content to payload
add compatible code for old message typepull/90/head
							parent
							
								
									3fdd036007
								
							
						
					
					
						commit
						cf2b4e4d2e
					
				@ -1,18 +1,33 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 收件箱记录项类型
 | 
			
		||||
 */
 | 
			
		||||
export interface InboxItem {
 | 
			
		||||
export interface BasicInboxItem {
 | 
			
		||||
  _id: string;
 | 
			
		||||
  userId: string;
 | 
			
		||||
  readed: boolean;
 | 
			
		||||
  type: 'message'; // will be more
 | 
			
		||||
  type: string;
 | 
			
		||||
  payload?: Record<string, any>;
 | 
			
		||||
  createdAt: string;
 | 
			
		||||
  updatedAt: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface MessageInboxItem extends BasicInboxItem {
 | 
			
		||||
  type: 'message';
 | 
			
		||||
  /**
 | 
			
		||||
   * @deprecated
 | 
			
		||||
   */
 | 
			
		||||
  message?: {
 | 
			
		||||
    groupId?: string;
 | 
			
		||||
    converseId: string;
 | 
			
		||||
    messageId: string;
 | 
			
		||||
    messageSnippet: string;
 | 
			
		||||
  };
 | 
			
		||||
  payload?: Record<string, any>;
 | 
			
		||||
  createdAt: string;
 | 
			
		||||
  updatedAt: string;
 | 
			
		||||
  payload: {
 | 
			
		||||
    groupId?: string;
 | 
			
		||||
    converseId: string;
 | 
			
		||||
    messageId: string;
 | 
			
		||||
    messageSnippet: string;
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type InboxItem = MessageInboxItem;
 | 
			
		||||
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue