mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-04 03:24:04 +00:00 
			
		
		
		
	Return the like status of a user over a group
This commit is contained in:
		@@ -49,4 +49,24 @@ export class LikesHelper {
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Check out whether the user likes an element or not
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param userID ID of the user
 | 
			
		||||
	 * @param id ID of the thing to check 
 | 
			
		||||
	 * @param type The kind of the element
 | 
			
		||||
	 */
 | 
			
		||||
	public static async IsLiking(userID: number, id: number, type: LikesType) : Promise<boolean> {
 | 
			
		||||
		if(userID == 0) return false;
 | 
			
		||||
 | 
			
		||||
		return await DatabaseHelper.Count({
 | 
			
		||||
			table: LIKES_TABLE,
 | 
			
		||||
			where: {
 | 
			
		||||
				ID_type: id,
 | 
			
		||||
				type: LikesKindsDB[type],
 | 
			
		||||
				ID_personne: userID
 | 
			
		||||
			}
 | 
			
		||||
		}) == 1;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user