mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-23 22:09:23 +00:00
28 lines
512 B
TypeScript
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);
|
||
|
}
|
||
|
|
||
|
}
|