Skip to content

Commit

Permalink
Merge pull request #53 from jennydo/matching-user
Browse files Browse the repository at this point in the history
Change endpoint for match users
  • Loading branch information
Euclid0192 authored Jul 2, 2024
2 parents 773b972 + 91cfaf9 commit 6de0843
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions controllers/match-user-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ const getMatchUsers = async (req, res) => {
}
};

// @route GET /matchUsers/:userId
// @route GET /matchUsers/
// @description: get a specific matchUser by its id
// @params: user id
// @access Private
const getMatchUser = async (req, res) => {
const { userId } = req.params;
const userId = req.user._id;

if (!userId) return res.status(400).json({ error: "User id is required" });

Expand Down Expand Up @@ -87,11 +87,10 @@ const fetchMatchPairs = async (req, res) => {

};

// @route GET /matchUsers/matchingPairs/:userId
// @route GET /matchUsers/matchingPairs/
// @description: get the user that got matched with this user
// @body: this userId
const getUserMatchPair = async (req, res) => {
const { userId } = req.params;
const userId = req.user._id;

if (!userId) return res.status(400).json({ error: "User id is required" });

Expand Down
2 changes: 1 addition & 1 deletion routes/match-user-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const {
matchUserRouter.use(requireAuth);
matchUserRouter.get("/", getMatchUsers);
matchUserRouter.post('/matchingPairs', fetchMatchPairs);
matchUserRouter.get('/matchingPairs/:userId', getUserMatchPair);
matchUserRouter.get('/matchingPairs', getUserMatchPair);
matchUserRouter.get("/:userId", getMatchUser);
matchUserRouter.post("/", createMatchUser);
matchUserRouter.patch("/:userId", updateMatchUser);
Expand Down

0 comments on commit 6de0843

Please sign in to comment.