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

28 lines
512 B
TypeScript
Raw Normal View History

2019-11-30 08:28:50 +00:00
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);
}
}