Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions app/scripts/add-user-to-admins.ts

This file was deleted.

74 changes: 0 additions & 74 deletions app/scripts/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,80 +614,6 @@ export async function addImagesToEvent(
return results;
}

// Administrator functions
export async function addUserToAdmins(userId: string) {
// First check if user exists in neon_auth.users_sync table
const { usersSync } = await import("drizzle-orm/neon");
const userExists = await db
.select()
.from(usersSync)
.where(eq(usersSync.id, userId))
.then((users) => users[0]);

if (!userExists) {
throw new Error(`User with ID ${userId} not found in users_sync table`);
}

// Check if user is already an admin
const { administratorsTable } = await import("../src/lib/schema");
const existingAdmin = await db
.select()
.from(administratorsTable)
.where(eq(administratorsTable.userId, userId))
.then((admins) => admins[0]);

if (existingAdmin) {
throw new Error(
`User ${userExists.name || userId} is already an administrator`,
);
}

// Add user to administrators table
const result = await db
.insert(administratorsTable)
.values({ userId })
.returning();

return {
admin: result[0],
user: userExists,
};
}

export async function removeUserFromAdmins(userId: string) {
const { administratorsTable } = await import("../src/lib/schema");

const result = await db
.delete(administratorsTable)
.where(eq(administratorsTable.userId, userId))
.returning();

if (!result[0]) {
throw new Error(`User ${userId} is not an administrator`);
}

return result[0];
}

export async function listAdmins() {
const { administratorsTable } = await import("../src/lib/schema");
const { usersSync } = await import("drizzle-orm/neon");

const admins = await db
.select({
id: administratorsTable.id,
userId: administratorsTable.userId,
createdAt: administratorsTable.createdAt,
updatedAt: administratorsTable.updatedAt,
userName: usersSync.name,
userEmail: usersSync.email,
})
.from(administratorsTable)
.leftJoin(usersSync, eq(administratorsTable.userId, usersSync.id));

return admins;
}

// Luma functions
export async function getLumaEvent(eventId: string) {
const lumaClient = createLumaClient();
Expand Down
27 changes: 0 additions & 27 deletions app/scripts/list-admins.ts

This file was deleted.

80 changes: 0 additions & 80 deletions app/scripts/mcp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ import {
deleteEventImages,
deleteOrphanedImage,
addImagesToEvent,
addUserToAdmins,
removeUserFromAdmins,
listAdmins,
getLumaEvent,
} from "./functions.js";

Expand Down Expand Up @@ -782,44 +779,6 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
draftReadinessTool,
...lumaToolDefinitions,
...socialToolDefinitions,
// Administrator tools
{
name: "add_user_to_admins",
description: "Add a user to administrators by user ID",
inputSchema: {
type: "object",
properties: {
userId: {
type: "string",
description: "User ID from neon_auth.users_sync table",
},
},
required: ["userId"],
},
},
{
name: "remove_user_from_admins",
description: "Remove a user from administrators by user ID",
inputSchema: {
type: "object",
properties: {
userId: {
type: "string",
description: "User ID to remove from administrators",
},
},
required: ["userId"],
},
},
{
name: "list_admins",
description: "List all administrators with user details",
inputSchema: {
type: "object",
properties: {},
required: [],
},
},
],
};
});
Expand Down Expand Up @@ -1142,33 +1101,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
};
}

// Administrator tools
case "add_user_to_admins": {
const { userId } = args as { userId: string };
const result = await addUserToAdmins(userId);
return {
content: [
{
type: "text",
text: JSON.stringify(result, null, 2),
},
],
};
}

case "remove_user_from_admins": {
const { userId } = args as { userId: string };
const result = await removeUserFromAdmins(userId);
return {
content: [
{
type: "text",
text: JSON.stringify(result, null, 2),
},
],
};
}

case "get_completeness_report": {
const { slug } = (args ?? {}) as { slug?: string };
const result = await completenessReport(slug);
Expand Down Expand Up @@ -1272,18 +1204,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
return { content: [{ type: "text", text }] };
}

case "list_admins": {
const result = await listAdmins();
return {
content: [
{
type: "text",
text: JSON.stringify(result, null, 2),
},
],
};
}

default:
throw new Error(`Unknown tool: ${toolName}`);
}
Expand Down
19 changes: 0 additions & 19 deletions app/scripts/remove-user-from-admins.ts

This file was deleted.

Loading