Align /msearch output to legacy format

This commit is contained in:
Hypolite Petovan 2018-12-24 09:45:47 -05:00
parent 2fcd282e83
commit 4da3acb52a
2 changed files with 21 additions and 21 deletions

View file

@ -65,24 +65,14 @@ Example:
{
"query": "videogame gaming boardgame politics philosophy development programming php",
"page": 1,
"itemsperpage": 80,
"count": 93,
"profiles": [
"items_page": 100,
"total": 32,
"results": [
{
"id": "2259",
"name": "Hyp🌧lite Pe☂ov🍃n (he/him)",
"username": "hypolite",
"addr": "hypolite@friendica.mrpetovan.com",
"account_type": "People",
"pdesc": "Subpar geek, french/english, science, games, feminism, jokes and anything in between. Avatar by @DearMsDear@mastodon.art",
"locality": "Brooklyn",
"region": "New York",
"country": "USA",
"profile_url": "https://friendica.mrpetovan.com/profile/hypolite",
"dfrn_request": "https://friendica.mrpetovan.com/dfrn_request/hypolite",
"photo": "https://friendica.mrpetovan.com/photo/27330388315ae4ed2b03e3c116980490-4.jpg?ts=1541567135",
"tags": "videogame gaming boardgame politics philosophy development programming php",
"last_activity": "2018-45"
"url": "https://friendica.mrpetovan.com/profile/hypolite",
"photo": "https://friendica.mrpetovan.com/photo/27330388315ae4ed2b03e3c116980490-4.jpg?ts=1545521478",
"tags": "videogame gaming boardgame politics philosophy development programming php"
},
...
]

View file

@ -53,14 +53,24 @@ class MatchSearch
$profiles = $this->profileModel->getListForDisplay($pager->getItemsPerPage(), $pager->getStart(), $sql_where, $values);
$results = [];
foreach ($profiles as $profile) {
$results[] = [
'name' => $profile['name'],
'url' => $profile['profile_url'],
'photo' => $profile['photo'],
'tags' => $profile['tags'],
];
}
$count = $this->profileModel->getCountForDisplay($sql_where, $values);
$vars = [
'query' => $query,
'page' => $pager->getPage(),
'itemsperpage' => $pager->getItemsPerPage(),
'count' => $count,
'profiles' => $profiles
'items_page' => $pager->getItemsPerPage(),
'total' => $count,
'results' => $results
];
return $response->withJson($vars);