mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-03 11:04:02 +00:00 
			
		
		
		
	Add search support
This commit is contained in:
		@@ -144,6 +144,27 @@ export class GroupsHelper {
 | 
			
		||||
		return this.DbToGroupInfo(row);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Search for groups
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param query The query
 | 
			
		||||
	 * @param limit LImit for the search
 | 
			
		||||
	 */
 | 
			
		||||
	public static async SearchGroup(query: string, limit: number = 10) : Promise<Array<number>> {
 | 
			
		||||
 | 
			
		||||
		const results = await DatabaseHelper.Query({
 | 
			
		||||
			table: GROUPS_LIST_TABLE,
 | 
			
		||||
			
 | 
			
		||||
			customWhere: "name LIKE ? AND visibility != ?",
 | 
			
		||||
			customWhereArgs: ["%"+query+"%", GroupVisibilityLevel.SECRETE_GROUP.toString()],
 | 
			
		||||
 | 
			
		||||
			limit: limit,
 | 
			
		||||
			fields: ["id"]
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		return results.map((e) => e.id);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Update (set) group settings
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user