Add name to provisioning

This commit is contained in:
Owen
2026-03-30 17:18:38 -07:00
parent 673b8b7af5
commit b8d7d5c910

View File

@@ -30,7 +30,8 @@ import { INSPECT_MAX_BYTES } from "buffer";
import { v } from "@faker-js/faker/dist/airline-Dz1uGqgJ"; import { v } from "@faker-js/faker/dist/airline-Dz1uGqgJ";
const bodySchema = z.object({ const bodySchema = z.object({
provisioningKey: z.string().nonempty() provisioningKey: z.string().nonempty(),
name: z.string().optional()
}); });
export type RegisterNewtBody = z.infer<typeof bodySchema>; export type RegisterNewtBody = z.infer<typeof bodySchema>;
@@ -56,7 +57,7 @@ export async function registerNewt(
); );
} }
const { provisioningKey } = parsedBody.data; const { provisioningKey, name } = parsedBody.data;
// Keys are in the format "siteProvisioningKeyId.secret" // Keys are in the format "siteProvisioningKeyId.secret"
const dotIndex = provisioningKey.indexOf("."); const dotIndex = provisioningKey.indexOf(".");
@@ -194,7 +195,7 @@ export async function registerNewt(
.insert(sites) .insert(sites)
.values({ .values({
orgId, orgId,
name: niceId, name: name || niceId,
niceId, niceId,
type: "newt", type: "newt",
dockerSocketEnabled: true, dockerSocketEnabled: true,