From 14604cfa6ac8eb63f222b3692d72e2e6da68eab2 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 24 Apr 2019 19:01:39 +0200 Subject: [PATCH] Changes for search Signed-off-by: Thomas Citharel --- js/src/graphql/search.ts | 23 ++++++++++++++---- js/src/types/search.model.ts | 13 ++++++++-- js/src/views/Search.vue | 47 +++++++++++++++++++++--------------- 3 files changed, 56 insertions(+), 27 deletions(-) diff --git a/js/src/graphql/search.ts b/js/src/graphql/search.ts index d846e46a4..4d40713f0 100644 --- a/js/src/graphql/search.ts +++ b/js/src/graphql/search.ts @@ -1,15 +1,28 @@ import gql from 'graphql-tag'; -export const SEARCH = gql` +export const SEARCH_EVENTS = gql` query SearchEvents($searchText: String!) { - search(search: $searchText) { - ...on Event { + searchEvents(search: $searchText) { + total, + elements { title, uuid, beginsOn, + tags { + slug, + title + }, __typename - }, - ...on Actor { + } + } +} +`; + +export const SEARCH_GROUPS = gql` +query SearchGroups($searchText: String!) { + searchGroups(search: $searchText) { + total, + elements { avatarUrl, domain, preferredUsername, diff --git a/js/src/types/search.model.ts b/js/src/types/search.model.ts index b865fbc3c..615f41dab 100644 --- a/js/src/types/search.model.ts +++ b/js/src/types/search.model.ts @@ -1,3 +1,12 @@ -export interface ISearch { - __typename: string; +import { IGroup } from '@/types/actor.model'; +import { IEvent } from '@/types/event.model'; + +export interface SearchEvent { + total: number; + elements: IEvent[]; +} + +export interface SearchGroup { + total: number; + elements: IGroup[]; } diff --git a/js/src/views/Search.vue b/js/src/views/Search.vue index 9ddd5146a..21a52bf0d 100644 --- a/js/src/views/Search.vue +++ b/js/src/views/Search.vue @@ -8,11 +8,11 @@ -
+
-
+
@@ -44,13 +44,12 @@