From c82a49b9b61dfc6bb10a2508a1e868412756217d Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 8 Nov 2025 21:07:19 +0000 Subject: [PATCH] completionId: cgen-dba140eb105b42db9ad0e18bd3d53b17 cgen-dba140eb105b42db9ad0e18bd3d53b17 --- api/discord/role-mappings.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/api/discord/role-mappings.ts b/api/discord/role-mappings.ts index 30da01d4..46bcf501 100644 --- a/api/discord/role-mappings.ts +++ b/api/discord/role-mappings.ts @@ -81,11 +81,14 @@ export default async function handler( // POST - Create new role mapping if (req.method === "POST") { try { - const { arm, discord_role, server_id, user_type } = req.body; + const { arm, discord_role, discord_role_name, server_id, user_type } = req.body; - if (!arm || !discord_role) { + // Support both discord_role and discord_role_name for compatibility + const roleName = discord_role_name || discord_role; + + if (!arm || !roleName) { return res.status(400).json({ - error: "arm and discord_role are required", + error: "arm and discord_role (or discord_role_name) are required", }); } @@ -94,7 +97,7 @@ export default async function handler( .insert({ arm, user_type: user_type || "community_member", - discord_role, + discord_role_name: roleName, server_id: server_id || null, }) .select()