add group color, owner manipulation

This commit is contained in:
2026-04-02 14:00:21 +02:00
parent 8459975f0c
commit b8690f5093
4 changed files with 178 additions and 99 deletions
+20
View File
@@ -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
}