Skip to content

Commit

Permalink
break matching-service into sub-services
Browse files Browse the repository at this point in the history
  • Loading branch information
abstxn committed Oct 17, 2024
1 parent 264d472 commit 080d28a
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 2,114 deletions.
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ services:
ports:
- 27018:27017

matching-service:
build: ./matching-service
request-service:
build: ./matching-service/request-service
ports:
- 3002:3002
depends_on:
- user-service
# - question-service # maybe to retrieve information on the questions difficulties/topics
volumes:
- ./matching-service:/app
- ./matching-service/request-service:/app
- /app/node_modules


Expand Down
2 changes: 1 addition & 1 deletion frontend-service/src/pages/MatchingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const MatchingPage: React.FC = () => {
const handleMatchMe = () => {
// TODO: Make a long-poll API request to `matching-service`
const getMatchLongPoll = () => {
fetch("http://localhost:3002/match-me", {
fetch("http://localhost:3002/find-match", {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "matching-service",
"name": "request-service",
"version": "1.0.0",
"main": "index.ts",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { Router } from 'express';

const router = Router();

router.post('/match-me', async (req, res) => {
// TODO: Set matchStatus of this specific user
// TODO: Wait for the user to be matched
// TODO: Return match found information
router.post('/find-match', async (req, res) => {
// console.log('Authorization Header:', req.headers.authorization);
// console.log('Request Body:', req.body);

console.log('Authorization Header:', req.headers.authorization);
console.log('Request Body:', req.body);
// TODO: Produce a `match-event`

// TODO: Consume a `match-found-event` ==> return match-found information

// Temporary code to simulate long-polling API return
const delay = 5000;
Expand All @@ -19,6 +19,10 @@ router.post('/match-me', async (req, res) => {
}, delay);
});

router.post('/cancel-matching', async (req, res) => {
// TODO: Produce a `cancel-match-event`
})

router.get('/match-status', async (req, res) => {
// TODO: Actually pull the correct match status instead of hardcoded
res.json({
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion user-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /app

COPY package*.json ./

RUN npm ci
RUN npm install

COPY . .

Expand Down
2 changes: 1 addition & 1 deletion user-service/controller/auth-controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bcrypt from "bcrypt";
import bcrypt from "bcryptjs";
import jwt from "jsonwebtoken";
import { findUserByEmail as _findUserByEmail } from "../model/repository.js";
import { formatUserResponse } from "./user-controller.js";
Expand Down
2 changes: 1 addition & 1 deletion user-service/controller/user-controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bcrypt from "bcrypt";
import bcrypt from "bcryptjs";
import { isValidObjectId } from "mongoose";
import {
createUser as _createUser,
Expand Down
Loading

0 comments on commit 080d28a

Please sign in to comment.