Add subnet CIDR support to the Active Directory management platform

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 705f2157-ef97-4fbd-89e4-8c7f2ecaea90
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7ed01c5f-a82d-405a-b728-b2e3d127c60c/38d85472-a91b-4a98-977a-cd9ab8f43196.jpg
This commit is contained in:
alphaeusmote
2025-04-09 20:27:55 +00:00
3 changed files with 11 additions and 0 deletions
+9
View File
@@ -4276,6 +4276,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
const description = req.body.description || ''; const description = req.body.description || '';
const location = req.body.location || ''; const location = req.body.location || '';
const siteObject = req.body.siteObject || ''; const siteObject = req.body.siteObject || '';
const cidr = req.body.cidr || '';
if (!subnetName) { if (!subnetName) {
return res.status(400).json({ message: "Subnet name is required" }); return res.status(400).json({ message: "Subnet name is required" });
@@ -4334,6 +4335,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
description: description, description: description,
location: location, location: location,
siteObject: siteObject, siteObject: siteObject,
cidr: cidr,
managedBy: null, managedBy: null,
adProperties: subnetData adProperties: subnetData
}); });
@@ -4391,6 +4393,9 @@ export async function registerRoutes(app: Express): Promise<Server> {
* siteObject: * siteObject:
* type: string * type: string
* description: The distinguishedName of the site this subnet belongs to * description: The distinguishedName of the site this subnet belongs to
* cidr:
* type: string
* description: The subnet CIDR notation (e.g., 192.168.1.0/24)
* managedBy: * managedBy:
* type: string * type: string
* responses: * responses:
@@ -4470,6 +4475,10 @@ export async function registerRoutes(app: Express): Promise<Server> {
updateData.siteObject = req.body.siteObject; updateData.siteObject = req.body.siteObject;
} }
if (req.body.cidr !== undefined) {
updateData.cidr = req.body.cidr;
}
// Handle managedBy separately // Handle managedBy separately
if (req.body.managedBy !== undefined) { if (req.body.managedBy !== undefined) {
// Set the managedBy attribute // Set the managedBy attribute
+1
View File
@@ -211,6 +211,7 @@ const swaggerOptions = {
location: { type: "string" }, location: { type: "string" },
networkAddress: { type: "string" }, networkAddress: { type: "string" },
networkMask: { type: "string" }, networkMask: { type: "string" },
cidr: { type: "string", description: "CIDR notation for the subnet (e.g., 192.168.1.0/24)" },
managedBy: { type: "string", description: "Distinguished name of the user or group managing this subnet" }, managedBy: { type: "string", description: "Distinguished name of the user or group managing this subnet" },
adProperties: { type: "object" }, adProperties: { type: "object" },
objectType: { type: "string", enum: ["subnet"] }, objectType: { type: "string", enum: ["subnet"] },
+1
View File
@@ -254,6 +254,7 @@ export const adSubnets = pgTable("ad_subnets", {
location: text("location"), location: text("location"),
networkAddress: text("network_address"), networkAddress: text("network_address"),
networkMask: text("network_mask"), networkMask: text("network_mask"),
cidr: text("cidr"),
managedBy: text("managed_by"), managedBy: text("managed_by"),
adProperties: jsonb("ad_properties"), adProperties: jsonb("ad_properties"),
objectType: text("object_type").default("subnet").notNull(), objectType: text("object_type").default("subnet").notNull(),