mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-03 19:14:03 +00:00 
			
		
		
		
	Can get older messages
This commit is contained in:
		@@ -276,6 +276,28 @@ export class ConversationsHelper {
 | 
			
		||||
		})).map(m => this.DBToConversationMessage(convID, m));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get older messages of a conversation
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param convID ID of the target conversation
 | 
			
		||||
	 * @param startID ID from which the research should start
 | 
			
		||||
	 * @param limit Maximum number of messages to get
 | 
			
		||||
	 * @return The list of messages
 | 
			
		||||
	 */
 | 
			
		||||
	public static async GetOlderMessage(convID: number, startID: number, limit: number) : Promise<Array<ConversationMessage>> {
 | 
			
		||||
		return (await DatabaseHelper.Query({
 | 
			
		||||
			table: MESSAGES_TABLE,
 | 
			
		||||
			where: {
 | 
			
		||||
				conv_id: convID,
 | 
			
		||||
			},
 | 
			
		||||
			customWhere: "ID <= ?",
 | 
			
		||||
			customWhereArgs: [startID.toString()],
 | 
			
		||||
			order: "id DESC",
 | 
			
		||||
			limit: limit
 | 
			
		||||
		}))
 | 
			
		||||
		.map(m => this.DBToConversationMessage(convID, m)).reverse();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Mark the user has seen the last messages of the conversation
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user