1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-26 15:29:22 +00:00
comunicapiv2/src/controllers/SearchController.ts

28 lines
512 B
TypeScript

import { RequestHandler } from "../entities/RequestHandler";
import { UserHelper } from "../helpers/UserHelper";
/**
* Search controller
*
* @author Pierre HUBERT
*/
export class SearchController {
/**
* Search for user
*
* @param h Request handler
*/
public static async SearchUser(h : RequestHandler) {
// Get request
const query = h.postString("query", 1);
const limit = h.postInt("searchLimit", 5);
const list = await UserHelper.SearchUser(query, limit);
h.send(list);
}
}