Skip to main content
Glama
v48.ts1.55 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 /* * Generated by @medplum/generator * Do not edit manually. */ import type { Project } from '@medplum/fhirtypes'; import type { PoolClient } from 'pg'; import { r4ProjectId } from '../../constants'; export async function run(client: PoolClient): Promise<void> { const r4Project: Project = { resourceType: 'Project', id: r4ProjectId, meta: { lastUpdated: new Date().toISOString(), }, name: 'FHIR R4', }; await client.query( `INSERT INTO "Project" (id, content, "lastUpdated", compartments, name) VALUES ($1, $2, $3, $4, $5) ON CONFLICT DO NOTHING`, [r4ProjectId, JSON.stringify(r4Project), r4Project.meta?.lastUpdated, [], r4Project.name] ); await moveOrphanResourcesIntoProject('StructureDefinition', r4ProjectId, client); await moveOrphanResourcesIntoProject('SearchParameter', r4ProjectId, client); await moveOrphanResourcesIntoProject('ValueSet', r4ProjectId, client); } const updateQuery = `UPDATE "__TABLE__" SET "projectId" = $1::UUID, compartments = ARRAY[$1]::UUID[], content = jsonb_set(content::jsonb, '{meta, project}'::text[], to_jsonb($1), true) WHERE ("projectId" IS NULL OR "projectId" = $1) AND "content" IS NOT NULL AND TRIM("content") <> ''`; async function moveOrphanResourcesIntoProject(table: string, projectId: string, client: PoolClient): Promise<void> { await client.query(updateQuery.replaceAll('__TABLE__', table), [projectId]); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server