Skip to content

Commit

Permalink
fix(be): column admin -> role in sql request
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Jul 8, 2023
1 parent 61e43b0 commit c1049c8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions db/sql/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ func (d *SqlDb) GetProjectUser(projectID, userID int) (db.ProjectUser, error) {
}

func (d *SqlDb) GetProjectUsers(projectID int, params db.RetrieveQueryParams) (users []db.User, err error) {
q := squirrel.Select("u.*").Column("pu.admin").
q := squirrel.Select("u.*").
Column("pu.role").
From("project__user as pu").
LeftJoin("`user` as u on pu.user_id=u.id").
Where("pu.project_id=?", projectID)
Expand All @@ -146,7 +147,7 @@ func (d *SqlDb) GetProjectUsers(projectID int, params db.RetrieveQueryParams) (u
switch params.SortBy {
case "name", "username", "email":
q = q.OrderBy("u." + params.SortBy + " " + sortDirection)
case "admin":
case "role":
q = q.OrderBy("pu." + params.SortBy + " " + sortDirection)
default:
q = q.OrderBy("u.name " + sortDirection)
Expand Down

0 comments on commit c1049c8

Please sign in to comment.