Signed-off-by: Andrew Thornton <art27@cantab.net>
type SearchUserOptions struct {
Keyword string
Type UserType
+ UID int64
OrderBy SearchOrderBy
Page int
PageSize int // Can be smaller than or equal to setting.UI.ExplorePagingNum
if opts.SearchByEmail {
keywordCond = keywordCond.Or(builder.Like{"LOWER(email)", lowerKeyword})
}
+
cond = cond.And(keywordCond)
}
+ if opts.UID > 0 {
+ cond = cond.And(builder.Eq{"id": opts.UID})
+ }
+
if !opts.IsActive.IsNone() {
cond = cond.And(builder.Eq{"is_active": opts.IsActive.IsTrue()})
}
// in: query
// description: keyword
// type: string
+ // - name: uid
+ // in: query
+ // description: ID of the user to search for
+ // type: integer
// - name: limit
// in: query
// description: maximum number of users to return
// "$ref": "#/definitions/User"
opts := &models.SearchUserOptions{
Keyword: strings.Trim(ctx.Query("q"), " "),
+ UID: com.StrTo(ctx.Query("uid")).MustInt64(),
Type: models.UserTypeIndividual,
PageSize: com.StrTo(ctx.Query("limit")).MustInt(),
}
"name": "q",
"in": "query"
},
+ {
+ "type": "integer",
+ "description": "ID of the user to search for",
+ "name": "uid",
+ "in": "query"
+ },
{
"type": "integer",
"description": "maximum number of users to return",