completionId: cgen-dba140eb105b42db9ad0e18bd3d53b17
cgen-dba140eb105b42db9ad0e18bd3d53b17
This commit is contained in:
parent
8d72a8b036
commit
c82a49b9b6
1 changed files with 7 additions and 4 deletions
|
|
@ -81,11 +81,14 @@ export default async function handler(
|
||||||
// POST - Create new role mapping
|
// POST - Create new role mapping
|
||||||
if (req.method === "POST") {
|
if (req.method === "POST") {
|
||||||
try {
|
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({
|
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({
|
.insert({
|
||||||
arm,
|
arm,
|
||||||
user_type: user_type || "community_member",
|
user_type: user_type || "community_member",
|
||||||
discord_role,
|
discord_role_name: roleName,
|
||||||
server_id: server_id || null,
|
server_id: server_id || null,
|
||||||
})
|
})
|
||||||
.select()
|
.select()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue