def get(self, query): """ Search Tickets that contains the query :param query: text to search :return: List of matched tickets """ projects = [] projects_query = ProjectMember.get_by_member(current_user.id) for p in projects_query: projects.append(str(p.project.pk)) return Ticket.search(query, projects), 200
def get(self, project_pk, query): """ Search Tickets by project :param project_pk: Project ID :param query: text to search :return: List of matched tickets """ prj = get_project_request(project_pk) tickets = set(Ticket.search(query, [str(prj.pk)])) results = [] for tkt in tickets: val = dict(text='%s-%s: %s' % (tkt.project.prefix, tkt.number, tkt.title), value=str(tkt.id)) results.append(val) return results, 200