add group color, owner manipulation
This commit is contained in:
+20
@@ -261,3 +261,23 @@ func DbSetClientGroups(ctx context.Context, client *Client) error {
|
||||
}
|
||||
return rows.Err()
|
||||
}
|
||||
|
||||
// DbSetGroupColor set group's color based on id
|
||||
// return: error if not successful
|
||||
func DbSetGroupColor(ctx context.Context, group *Group) error {
|
||||
_, err := dbConn.Exec(ctx, `
|
||||
UPDATE chat_groups SET color_red = $1, color_green = $2, color_blue = $3 WHERE id = $4
|
||||
`, group.Color[0], group.Color[1], group.Color[2], group.Id)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DbSetGroupOwnerId set group's owner based on id
|
||||
// return: error if not successful
|
||||
func DbSetGroupOwnerId(ctx context.Context, group *Group) error {
|
||||
_, err := dbConn.Exec(ctx, `
|
||||
UPDATE chat_groups SET owner_id = $1 WHERE id = $2
|
||||
`, group.OwnerId, group.Id)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user