Skip to content

Commit

Permalink
fix(routes): update user_id retrieval logic to get user_id from param…
Browse files Browse the repository at this point in the history
…s instead of query (#28)
  • Loading branch information
chimpdev authored Nov 16, 2024
1 parent cd99b2a commit 39eb711
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib/express/routes/api/v1/users/[user_id]/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { decrypt } from '@/utils/encryption';
import type { Request, Response } from 'express';
import { IncomingHttpHeaders } from 'node:http';

interface RequestQuery {
interface RequestParams {
user_id: string;
}

Expand All @@ -21,8 +21,8 @@ export const get = [
.isNumeric().withMessage('user_id must be a number.')
.isLength({ min: 17, max: 19 }).withMessage('user_id must be 17-19 characters long.'),
validateRequest,
async (request: Request<unknown, unknown, unknown, RequestQuery>, response: Response) => {
const { user_id } = request.query;
async (request: Request<RequestParams>, response: Response) => {
const { user_id } = request.params;

const guild = client.guilds.cache.get(config.base_guild_id);
const member = guild.members.cache.get(user_id);
Expand All @@ -46,8 +46,8 @@ export const del = [
.isNumeric().withMessage('user_id must be a number.')
.isLength({ min: 17, max: 19 }).withMessage('user_id must be 17-19 characters long.'),
validateRequest,
async (request: Request<unknown, unknown, unknown, RequestQuery>, response: Response) => {
const { user_id } = request.query;
async (request: Request<RequestParams>, response: Response) => {
const { user_id } = request.params;

const guild = client.guilds.cache.get(config.base_guild_id);
const member = guild.members.cache.get(user_id);
Expand Down

0 comments on commit 39eb711

Please sign in to comment.