refactor eth routes

This commit is contained in:
Tanner Shaw
2023-10-24 16:56:39 -05:00
parent af6d6a3b81
commit b65015c4c8
2 changed files with 8 additions and 8 deletions

View File

@@ -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;

View File

@@ -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 {