From b65015c4c8c52266768d8742910a8b5efe3e54fe Mon Sep 17 00:00:00 2001 From: Tanner Shaw Date: Tue, 24 Oct 2023 16:56:39 -0500 Subject: [PATCH] refactor eth routes --- src/endpoints/gateways/discord.ts | 4 ++-- src/endpoints/gateways/ethereumGroup.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/endpoints/gateways/discord.ts b/src/endpoints/gateways/discord.ts index bbcf744..bffc421 100644 --- a/src/endpoints/gateways/discord.ts +++ b/src/endpoints/gateways/discord.ts @@ -25,7 +25,7 @@ const adminAuth = basicAuth({ * @param {string} guildId - The id of the guild to be added * @returns {void} */ -router.post('/api/discord/addguild', adminAuth, limiter, (req, res) => { +router.post('/addguild', adminAuth, limiter, (req, res) => { const { guildId } = req.body as { guildId: string; }; @@ -62,7 +62,7 @@ router.post('/api/discord/addguild', adminAuth, limiter, (req, res) => { * @param {string} guildId - The id of the guild to be added * @returns {void} */ -router.post('/api/discord/addrole', limiter, adminAuth, (req, res) => { +router.post('/addrole', limiter, adminAuth, (req, res) => { const { roles, roomId, guildId } = req.body as { roles: string[]; roomId: string; diff --git a/src/endpoints/gateways/ethereumGroup.ts b/src/endpoints/gateways/ethereumGroup.ts index 5342c5b..7425a3e 100644 --- a/src/endpoints/gateways/ethereumGroup.ts +++ b/src/endpoints/gateways/ethereumGroup.ts @@ -54,7 +54,7 @@ router.get('/groups/all', adminAuth, (req: Request, res: Response) => { * "address": "string" * } */ -router.get(['/eth/group/:address', '/api/eth/group/:address'], limiter, (req, res) => { +router.get('/group/:address', limiter, (req, res) => { const { address } = req.params as { address: string }; prisma.ethereumGroup .findMany({ @@ -90,7 +90,7 @@ router.get(['/eth/group/:address', '/api/eth/group/:address'], limiter, (req, re */ router.post( - ['/eth/group/create', '/api/eth/group/create'], + '/group/create', adminAuth, asyncHandler(async (req: Request, res: Response) => { const { name, roomIds } = req.body as { @@ -114,7 +114,7 @@ router.post( * @param {string[]} ethAddresses - The addresses to add to the Ethereum groups */ router.post( - ['/eth/group/add', '/api/eth/group/add'], + '/group/add', adminAuth, asyncHandler(async (req: Request, res: Response) => { const { names, ethAddresses } = req.body as { @@ -153,7 +153,7 @@ router.post( * } */ router.post( - ['/eth/group/edit', '/api/eth/group/edit'], + '/group/edit', adminAuth, asyncHandler(async (req: Request, res: Response) => { const { name, ethAddresses, roomIds } = req.body as { @@ -204,7 +204,7 @@ router.post( * "name": "string" * } */ -router.post(['/eth/group/delete', '/api/eth/group/delete'], adminAuth, (req, res) => { +router.post('/group/delete', adminAuth, (req, res) => { const { name } = req.body as { name: string }; prisma.ethereumGroup .delete({ @@ -234,7 +234,7 @@ router.post(['/eth/group/delete', '/api/eth/group/delete'], adminAuth, (req, res * } */ router.post( - ['/gateway/eth/message/sign'], + '/message/sign', limiter, asyncHandler(async (req: Request, res: Response) => { const { message, signature } = req.body as {