mirror of
https://github.com/fosrl/pangolin.git
synced 2026-04-29 09:12:56 +00:00
Accept nice id when creating
This commit is contained in:
@@ -38,6 +38,7 @@ const createSiteResourceSchema = z
|
|||||||
name: z.string().min(1).max(255),
|
name: z.string().min(1).max(255),
|
||||||
mode: z.enum(["host", "cidr", "port"]),
|
mode: z.enum(["host", "cidr", "port"]),
|
||||||
siteId: z.int(),
|
siteId: z.int(),
|
||||||
|
niceId: z.string().optional(),
|
||||||
// protocol: z.enum(["tcp", "udp"]).optional(),
|
// protocol: z.enum(["tcp", "udp"]).optional(),
|
||||||
// proxyPort: z.int().positive().optional(),
|
// proxyPort: z.int().positive().optional(),
|
||||||
// destinationPort: z.int().positive().optional(),
|
// destinationPort: z.int().positive().optional(),
|
||||||
@@ -160,6 +161,7 @@ export async function createSiteResource(
|
|||||||
const {
|
const {
|
||||||
name,
|
name,
|
||||||
siteId,
|
siteId,
|
||||||
|
niceId,
|
||||||
mode,
|
mode,
|
||||||
// protocol,
|
// protocol,
|
||||||
// proxyPort,
|
// proxyPort,
|
||||||
@@ -278,7 +280,11 @@ export async function createSiteResource(
|
|||||||
tierMatrix.sshPam
|
tierMatrix.sshPam
|
||||||
);
|
);
|
||||||
|
|
||||||
const niceId = await getUniqueSiteResourceName(orgId);
|
let updatedNiceId = niceId;
|
||||||
|
if (!niceId) {
|
||||||
|
updatedNiceId = await getUniqueSiteResourceName(orgId);
|
||||||
|
}
|
||||||
|
|
||||||
let aliasAddress: string | null = null;
|
let aliasAddress: string | null = null;
|
||||||
if (mode == "host") {
|
if (mode == "host") {
|
||||||
// we can only have an alias on a host
|
// we can only have an alias on a host
|
||||||
@@ -290,7 +296,7 @@ export async function createSiteResource(
|
|||||||
// Create the site resource
|
// Create the site resource
|
||||||
const insertValues: typeof siteResources.$inferInsert = {
|
const insertValues: typeof siteResources.$inferInsert = {
|
||||||
siteId,
|
siteId,
|
||||||
niceId,
|
niceId: updatedNiceId!,
|
||||||
orgId,
|
orgId,
|
||||||
name,
|
name,
|
||||||
mode: mode as "host" | "cidr",
|
mode: mode as "host" | "cidr",
|
||||||
|
|||||||
Reference in New Issue
Block a user