mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-31 06:59:33 +02:00
Not optional
This commit is contained in:
parent
a0abe41c8a
commit
6cf3bf0255
1 changed files with 4 additions and 12 deletions
|
@ -37,10 +37,9 @@ const createClientSchema = z
|
||||||
.object({
|
.object({
|
||||||
name: z.string().min(1).max(255),
|
name: z.string().min(1).max(255),
|
||||||
siteId: z.number().int().positive(),
|
siteId: z.number().int().positive(),
|
||||||
pubKey: z.string().optional(),
|
subnet: z.string(),
|
||||||
subnet: z.string().optional(),
|
olmId: z.string(),
|
||||||
olmId: z.string().optional(),
|
secret: z.string(),
|
||||||
secret: z.string().optional(),
|
|
||||||
type: z.enum(["olm"])
|
type: z.enum(["olm"])
|
||||||
})
|
})
|
||||||
.strict();
|
.strict();
|
||||||
|
@ -65,7 +64,7 @@ export async function createClient(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name, type, siteId, pubKey, subnet, olmId, secret } =
|
const { name, type, siteId, subnet, olmId, secret } =
|
||||||
parsedBody.data;
|
parsedBody.data;
|
||||||
|
|
||||||
const parsedParams = createClientParamsSchema.safeParse(req.params);
|
const parsedParams = createClientParamsSchema.safeParse(req.params);
|
||||||
|
@ -104,12 +103,6 @@ export async function createClient(
|
||||||
return next(createHttpError(HttpCode.NOT_FOUND, "Site not found"));
|
return next(createHttpError(HttpCode.NOT_FOUND, "Site not found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (site.type !== "newt") {
|
|
||||||
return next(
|
|
||||||
createHttpError(HttpCode.BAD_REQUEST, "Site is not a newt site")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
await db.transaction(async (trx) => {
|
await db.transaction(async (trx) => {
|
||||||
const adminRole = await trx
|
const adminRole = await trx
|
||||||
.select()
|
.select()
|
||||||
|
@ -132,7 +125,6 @@ export async function createClient(
|
||||||
siteId,
|
siteId,
|
||||||
orgId: site.orgId,
|
orgId: site.orgId,
|
||||||
name,
|
name,
|
||||||
pubKey,
|
|
||||||
subnet,
|
subnet,
|
||||||
type
|
type
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue