1
0

Implemented search for everything (#17)

This commit is contained in:
konrad
2018-11-09 17:33:06 +00:00
committed by Gitea
parent ad74d24ee2
commit d3de658882
18 changed files with 49 additions and 32 deletions

View File

@ -1,7 +1,7 @@
package models
// ReadAll implements the method to read all teams of a namespace
func (tn *TeamNamespace) ReadAll(user *User, page int) (interface{}, error) {
func (tn *TeamNamespace) ReadAll(search string, user *User, page int) (interface{}, error) {
// Check if the user can read the namespace
n, err := GetNamespaceByID(tn.NamespaceID)
if err != nil {
@ -18,6 +18,7 @@ func (tn *TeamNamespace) ReadAll(user *User, page int) (interface{}, error) {
Join("INNER", "team_namespaces", "team_id = teams.id").
Where("team_namespaces.namespace_id = ?", tn.NamespaceID).
Limit(getLimitFromPageIndex(page)).
Where("teams.name LIKE ?", "%"+search+"%").
Find(&all)
return all, err