Skip to content

Commit 8aa3b5b

Browse files
Comments added
1 parent 25cb1ef commit 8aa3b5b

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

models/user.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,8 @@ func SearchUsers(opts *SearchUserOptions) (users []*User, _ int64, _ error) {
13601360
Find(&users)
13611361
}
13621362

1363+
//SearchUsersAPI takes options i.e keyword and part of user name to search
1364+
//it returns all the results found and the number of total results.
13631365
func SearchUsersAPI(opts *SearchUserOptions) (users []*User,_ int64,_ error){
13641366
cond := opts.toConds()
13651367
count,err := x.Where(cond).Count(new(User))

routers/api/v1/admin/org.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,18 @@ func CreateOrg(ctx *context.APIContext, form api.CreateOrgOption) {
6767
ctx.JSON(201, convert.ToOrganization(org))
6868
}
6969

70+
//GetAllOrgs API for getting information of all the organizations
7071
func GetAllOrgs(ctx *context.APIContext){
72+
// swagger:operation GET /admin/orgs admin adminGetAllOrgs
73+
// ---
74+
// summary: List all organizations
75+
// produces:
76+
// - application/json
77+
// responses:
78+
// "200":
79+
// "$ref": "#/responses/OrganizationList"
80+
// "403":
81+
// "$ref": "#/responses/forbidden"
7182
users,_,err := models.SearchUsersAPI(&models.SearchUserOptions{
7283
Type: models.UserTypeOrganization,
7384
OrderBy: models.SearchOrderByAlphabetically,

routers/api/v1/admin/user.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,18 @@ func DeleteUserPublicKey(ctx *context.APIContext) {
292292
ctx.Status(204)
293293
}
294294

295+
//GetAllUsers API for getting information of all the users
295296
func GetAllUsers(ctx *context.APIContext){
297+
// swagger:operation GET /admin/users admin adminGetAllUsers
298+
// ---
299+
// summary: List all organizations
300+
// produces:
301+
// - application/json
302+
// responses:
303+
// "200":
304+
// "$ref": "#/responses/UserList"
305+
// "403":
306+
// "$ref": "#/responses/forbidden"
296307
users,_,err := models.SearchUsersAPI(&models.SearchUserOptions{
297308
Type: models.UserTypeIndividual,
298309
OrderBy: models.SearchOrderByAlphabetically,

0 commit comments

Comments
 (0)