Skip to content

Commit

Permalink
chore: Remove service metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith committed Dec 1, 2024
1 parent f339c48 commit 94aab16
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 85 deletions.
17 changes: 0 additions & 17 deletions control-plane/src/modules/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,23 +756,6 @@ export const definition = {
messageId: z.string(),
}),
},
storeServiceMetadata: {
method: "PUT",
path: "/clusters/:clusterId/services/:service/keys/:key",
headers: z.object({ authorization: z.string() }),
body: z.object({
value: z.string(),
}),
pathParams: z.object({
clusterId: z.string(),
service: z.string(),
key: z.string(),
}),
responses: {
204: z.undefined(),
401: z.undefined(),
},
},
getClusterExport: {
method: "GET",
path: "/clusters/:clusterId/export",
Expand Down
20 changes: 0 additions & 20 deletions control-plane/src/modules/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,26 +220,6 @@ export const integrations = pgTable(
}),
);

export const serviceMetadata = pgTable(
"service_metadata",
{
cluster_id: varchar("cluster_id")
.references(() => clusters.id)
.notNull(),
service: varchar("service", { length: 1024 }).notNull(),
key: text("status", {
enum: ["incoming-webhook-token"],
}).notNull(),
value: text("value").notNull(),
},
(table) => ({
pk: primaryKey({
columns: [table.cluster_id, table.service, table.key],
name: "service_metadata_cluster_id_service_key",
}),
}),
);

export const workflowMetadata = pgTable(
"workflow_metadata",
{
Expand Down
25 changes: 0 additions & 25 deletions control-plane/src/modules/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { contract } from "./contract";
import * as data from "./data";
import * as management from "./management";
import * as events from "./observability/events";
import { storeServiceMetadata } from "./service-metadata";
import {
assertGenericMessage,
editHumanMessage,
Expand Down Expand Up @@ -339,30 +338,6 @@ export const router = initServer().router(contract, {
body: messages.upserted,
};
},
storeServiceMetadata: async (request) => {
const machine = request.request.getAuth().isMachine();

const { clusterId, service, key } = request.params;
const { value } = request.body;

if (machine.clusterId !== clusterId) {
return {
status: 401,
};
}

await storeServiceMetadata({
clusterId,
key,
value,
service,
});

return {
status: 204,
body: undefined,
};
},
getClusterExport: async (request) => {
const { clusterId } = request.params;

Expand Down
23 changes: 0 additions & 23 deletions control-plane/src/modules/service-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,3 @@ export const storeServiceMetadata = async ({
});
};

export const getServiceMetadata = async ({
clusterId,
service,
key,
}: {
service: string;
clusterId: string;
key: string;
}) => {
return db
.select({
key: serviceMetadata.key,
value: serviceMetadata.value,
})
.from(serviceMetadata)
.where(
and(
eq(serviceMetadata.cluster_id, clusterId),
eq(serviceMetadata.service, service),
eq(serviceMetadata.key, keySchema.parse(key)),
),
);
};

0 comments on commit 94aab16

Please sign in to comment.