MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / updateHostedBrand

Method updateHostedBrand

server/src/db/brand-db.ts:260–296  ·  view source on GitHub ↗

* Update a hosted brand

(id: string, input: UpdateHostedBrandInput)

Source from the content-addressed store, hash-verified

258 * Update a hosted brand
259 */
260 async updateHostedBrand(id: string, input: UpdateHostedBrandInput): Promise<HostedBrand | null> {
261 const updates: string[] = ['updated_at = NOW()'];
262 const values: unknown[] = [];
263 let paramIndex = 1;
264
265 // Alias brands columns to match HostedBrand interface
266 if (input.brand_json !== undefined) {
267 updates.push(`brand_manifest = $${paramIndex++}`);
268 values.push(JSON.stringify(input.brand_json));
269 }
270 if (input.domain_verified !== undefined) {
271 updates.push(`domain_verified = $${paramIndex++}`);
272 values.push(input.domain_verified);
273 }
274 if (input.verification_token !== undefined) {
275 updates.push(`verification_token = $${paramIndex++}`);
276 values.push(input.verification_token);
277 }
278 if (input.is_public !== undefined) {
279 updates.push(`is_public = $${paramIndex++}`);
280 values.push(input.is_public);
281 }
282 if (input.workos_organization_id !== undefined) {
283 updates.push(`workos_organization_id = $${paramIndex++}`);
284 values.push(input.workos_organization_id);
285 }
286
287 values.push(id);
288 const result = await query<HostedBrand>(
289 `UPDATE brands SET ${updates.join(', ')} WHERE id = $${paramIndex}
290 RETURNING id, workos_organization_id, created_by_user_id, created_by_email,
291 domain AS brand_domain, brand_manifest AS brand_json,
292 domain_verified, verification_token, is_public, created_at, updated_at`,
293 values
294 );
295 return result.rows[0] ? this.deserializeHostedBrand(result.rows[0]) : null;
296 }
297
298 /**
299 * Relinquish a hosted brand back to the discovered/community pool.

Callers 4

setupRoutesMethod · 0.80
scanBrandForDomainMethod · 0.80
createRegistryApiRouterFunction · 0.80

Calls 1

Tested by

no test coverage detected