fix: channel PATCH was nulling group_id on name-only updates
group_id = without COALESCE wrote NULL when only name was sent, orphaning the channel from its group.
This commit is contained in:
@@ -366,7 +366,7 @@ func (h *Handler) Update(w http.ResponseWriter, r *http.Request) {
|
|||||||
category = COALESCE($3, category),
|
category = COALESCE($3, category),
|
||||||
position = COALESCE($4, position),
|
position = COALESCE($4, position),
|
||||||
slowmode_seconds = COALESCE($5, slowmode_seconds),
|
slowmode_seconds = COALESCE($5, slowmode_seconds),
|
||||||
group_id = $7
|
group_id = COALESCE($7, group_id)
|
||||||
WHERE id = $6
|
WHERE id = $6
|
||||||
RETURNING id, server_id, name, type, category, position, slowmode_seconds, group_id, created_at
|
RETURNING id, server_id, name, type, category, position, slowmode_seconds, group_id, created_at
|
||||||
`, req.Name, req.Type, req.Category, req.Position, req.SlowmodeSeconds, channelID, req.GroupID).Scan(
|
`, req.Name, req.Type, req.Category, req.Position, req.SlowmodeSeconds, channelID, req.GroupID).Scan(
|
||||||
|
|||||||
Reference in New Issue
Block a user