A shop can be renamed and, while empty, removed - from head office
The display name was always meant to be editable and the slug frozen;
until now neither had a way in. PATCH /api/sites/{site} takes a name
and a timezone (manager and above), DELETE removes an empty shop
(owner). The shop drawer in head office gets both, with the short name
shown read-only and the reason beside it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGcjxF1cNLcuwc3DAPcnfj
This commit is contained in:
@@ -146,3 +146,15 @@ func (s *Store) DeleteEmptySite(ctx context.Context, clientID, siteID string) (s
|
||||
}
|
||||
return username, tx.Commit(ctx)
|
||||
}
|
||||
|
||||
func (s *Store) UpdateSite(ctx context.Context, clientID, siteID string, in api.SiteUpdate) (api.SiteHealth, error) {
|
||||
var out api.SiteHealth
|
||||
err := s.pool.QueryRow(ctx, `
|
||||
UPDATE sites
|
||||
SET name = COALESCE($3, name),
|
||||
timezone = COALESCE($4, timezone)
|
||||
WHERE id = $1::uuid AND client_id = $2::uuid
|
||||
RETURNING id::text, slug, name, timezone`, siteID, clientID, in.Name, in.Timezone).
|
||||
Scan(&out.SiteID, &out.Slug, &out.Name, &out.Timezone)
|
||||
return out, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user