Skip to content

Feature swipe#166

Merged
zakkiyyat merged 5 commits intoMixMatch-Inc:mainfrom
rmsb-art:feature-swipe
Mar 7, 2026
Merged

Feature swipe#166
zakkiyyat merged 5 commits intoMixMatch-Inc:mainfrom
rmsb-art:feature-swipe

Conversation

@rmsb-art
Copy link
Contributor

@rmsb-art rmsb-art commented Mar 7, 2026

This PR introduces the POST /api/swipe endpoint to persist user swipe decisions. The endpoint accepts { foodId: string, action: 'like' | 'pass' } and validates the payload using the Phase 1 validation middleware. When a user passes, the swipe is recorded in the UserSwipe collection. When a user likes an item, the swipe is recorded and a corresponding entry is created in the CartItem/Match collection tied to the user’s active session. The endpoint also verifies that the provided foodId exists and returns 404 Not Found if it does not, ensuring reliable database writes and proper error handling.

closes #152

Copy link
Contributor

@zakkiyyat zakkiyyat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the merge conflicts with the target branch and we can proceed with the merge.

Comment on lines +17 to +18
const userIdHeader = req.header("x-user-id")
if (!userIdHeader) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the POST /api/swipe implementation for robustness and production safety.
Focus on:

  • input hardening for foodId and user identity values
  • failure behavior and status codes for malformed IDs
  • consistency of swipe/cart writes and possible partial-write scenarios
  • schema/index assumptions for high-volume swipe traffic
  • Flag any blocker-level issue before merge.

rmsb-art added 3 commits March 7, 2026 14:58
# Conflicts:
#	backend/README.md
#	backend/src/middleware/validate-request.middleware.ts
#	backend/src/models/food-item.model.ts
#	backend/src/models/index.ts
#	backend/src/routes/index.ts
Copy link
Contributor

@zakkiyyat zakkiyyat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Approving for merge.

@zakkiyyat zakkiyyat merged commit 50299ca into MixMatch-Inc:main Mar 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Match & Pass API Logic

2 participants