Saved filters #655
|
@ -257,6 +257,22 @@ func (n *Namespace) ReadAll(a web.Auth, search string, page int, perPage int) (r
|
||||||
return nil, 0, 0, err
|
return nil, 0, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
numberOfTotalItems, err = x.
|
||||||
|
Table("namespaces").
|
||||||
|
Join("LEFT", "team_namespaces", "namespaces.id = team_namespaces.namespace_id").
|
||||||
|
Join("LEFT", "team_members", "team_members.team_id = team_namespaces.team_id").
|
||||||
|
Join("LEFT", "users_namespace", "users_namespace.namespace_id = namespaces.id").
|
||||||
|
Where("team_members.user_id = ?", doer.ID).
|
||||||
|
Or("namespaces.owner_id = ?", doer.ID).
|
||||||
|
Or("users_namespace.user_id = ?", doer.ID).
|
||||||
|
And("namespaces.is_archived = false").
|
||||||
|
GroupBy("namespaces.id").
|
||||||
|
Where("namespaces.title LIKE ?", "%"+search+"%").
|
||||||
|
Count(&NamespaceWithLists{})
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Shared Lists
|
// Shared Lists
|
||||||
|
|
||||||
|
@ -353,24 +369,6 @@ func (n *Namespace) ReadAll(a web.Auth, search string, page int, perPage int) (r
|
||||||
/////////////////
|
/////////////////
|
||||||
// Saved Filters
|
// Saved Filters
|
||||||
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
numberOfTotalItems, err = x.
|
|
||||||
Table("namespaces").
|
|
||||||
Join("LEFT", "team_namespaces", "namespaces.id = team_namespaces.namespace_id").
|
|
||||||
Join("LEFT", "team_members", "team_members.team_id = team_namespaces.team_id").
|
|
||||||
Join("LEFT", "users_namespace", "users_namespace.namespace_id = namespaces.id").
|
|
||||||
Where("team_members.user_id = ?", doer.ID).
|
|
||||||
Or("namespaces.owner_id = ?", doer.ID).
|
|
||||||
Or("users_namespace.user_id = ?", doer.ID).
|
|
||||||
And("namespaces.is_archived = false").
|
|
||||||
GroupBy("namespaces.id").
|
|
||||||
Where("namespaces.title LIKE ?", "%"+search+"%").
|
|
||||||
Count(&NamespaceWithLists{})
|
|
||||||
if err != nil {
|
|
||||||
return nil, 0, 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
// Put it all together
|
// Put it all together
|
||||||
all := make([]*NamespaceWithLists, 0, len(namespaces))
|
all := make([]*NamespaceWithLists, 0, len(namespaces))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user