mirror of https://github.com/harness/drone.git
feat: [CODE-2573]: Allow ID to be sent in userGroupInfo object (#2923)
* feat: [CODE-2573]: Scan UserGroup ID to be returned after creation * feat: [CODE-2573]: Allow ID to be sent in userGroupInfo objectpull/3586/head
parent
975cec7f53
commit
2f45f99f8b
|
@ -198,7 +198,7 @@ func (s *UserGroupStore) Create(
|
||||||
return database.ProcessSQLErrorf(ctx, err, "Failed to bind usergroup object")
|
return database.ProcessSQLErrorf(ctx, err, "Failed to bind usergroup object")
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = db.ExecContext(ctx, query, arg...); err != nil {
|
if err = db.QueryRowContext(ctx, query, arg...).Scan(&userGroup.ID); err != nil {
|
||||||
return database.ProcessSQLErrorf(ctx, err, "Failed to insert usergroup")
|
return database.ProcessSQLErrorf(ctx, err, "Failed to insert usergroup")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ type UserGroup struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserGroupInfo struct {
|
type UserGroupInfo struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
Identifier string `json:"identifier"`
|
Identifier string `json:"identifier"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
|
@ -34,6 +35,7 @@ type UserGroupInfo struct {
|
||||||
|
|
||||||
func (u *UserGroup) ToUserGroupInfo() *UserGroupInfo {
|
func (u *UserGroup) ToUserGroupInfo() *UserGroupInfo {
|
||||||
return &UserGroupInfo{
|
return &UserGroupInfo{
|
||||||
|
ID: u.ID,
|
||||||
Identifier: u.Identifier,
|
Identifier: u.Identifier,
|
||||||
Name: u.Name,
|
Name: u.Name,
|
||||||
Description: u.Description,
|
Description: u.Description,
|
||||||
|
|
Loading…
Reference in New Issue