Skip to content

Commit 2ff03c3

Browse files
committed
chore: move proto files into individual services
1 parent 47eb5f0 commit 2ff03c3

File tree

16 files changed

+380
-56
lines changed

16 files changed

+380
-56
lines changed

apps/matching-service/README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,23 @@ Client sends matching parameters:
7676
"type": "match_request",
7777
"topics": ["Algorithms", "Arrays"],
7878
"difficulties": ["Easy", "Medium"],
79-
"username": "Jane Doe"
79+
"username": "1f0myn"
8080
}
8181
```
8282

8383
Server response on successful match:
8484

8585
```json
8686
{
87-
"type": "match_found",
88-
"matchId": "1c018916a34c5bee21af0b2670bd6156",
89-
"user": "zkb4px",
90-
"matchedUser": "JohnDoe",
91-
"topic": "Algorithms",
92-
"difficulty": "Medium"
87+
"type": "match_question_found",
88+
"match_id": "c377f463d380a9bd1dd03242892ef32e",
89+
"user": "1f0myn",
90+
"matched_user": "jrsznp",
91+
"matched_topics": ["Graphs", "Bit Manipulation", "Databases"],
92+
"question_doc_ref_id": "5lObMfyyKPgNXSuLcGEm",
93+
"question_name": "Repeated DNA Sequences",
94+
"question_difficulty": "medium",
95+
"question_topics": ["Algorithms", "Bit Manipulation"]
9396
}
9497
```
9598

@@ -128,21 +131,25 @@ Before running the following commands, ensure that the URL for the Redis server
128131
To run the application via Docker, run the following command:
129132

130133
1. Set up the Go Docker container for the matching service
134+
131135
```bash
132136
docker build -f Dockerfile -t match-go-app .
133137
```
134138

135139
2. Create the Docker network for Redis and Go
140+
136141
```bash
137142
docker network create redis-go-network
138143
```
139144

140145
3. Start a new Redis container in detached mode using the Redis image from Docker Hub
146+
141147
```bash
142148
docker run -d --name redis-container --network redis-go-network redis
143149
```
144150

145151
4. Run the Go Docker container for the matching-service
152+
146153
```bash
147154
docker run -d -p 8081:8081 --name go-app-container --network redis-go-network match-go-app
148155
```

apps/matching-service/go.mod

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@ module matching-service
22

33
go 1.23.1
44

5-
replace proto => ../proto
6-
75
require (
86
github.com/bsm/redislock v0.9.4
97
github.com/gorilla/websocket v1.5.3
108
github.com/joho/godotenv v1.5.1
119
github.com/redis/go-redis/v9 v9.6.2
1210
google.golang.org/grpc v1.67.1
1311
google.golang.org/protobuf v1.35.1
14-
proto v0.0.0-00010101000000-000000000000
1512
)
1613

1714
require (

apps/matching-service/processes/performmatches.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"log"
99
"matching-service/databases"
1010
"matching-service/models"
11-
pb "proto/questionmatching"
11+
pb "matching-service/proto"
1212

1313
"matching-service/servers"
1414

apps/proto/questionmatching/questionmatching.pb.go renamed to apps/matching-service/proto/questionmatching.pb.go

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/proto/questionmatching/questionmatching_grpc.pb.go renamed to apps/matching-service/proto/questionmatching_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/matching-service/servers/grpc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package servers
22

33
import (
44
"log"
5-
pb "proto/questionmatching"
5+
pb "matching-service/proto"
66

77
"google.golang.org/grpc"
88
"google.golang.org/grpc/credentials/insecure"

apps/proto/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export PATH="$PATH:$(go env GOPATH)/bin"
3636
Now use the protoc compiler to generate the Go code for the service and messages.
3737

3838
```bash
39-
protoc --go_out=. --go-grpc_out=. ./questionmatching.proto
39+
protoc --go_out=../matching-service --go-grpc_out=../matching-service ./questionmatching.proto
40+
protoc --go_out=../question-service --go-grpc_out=../question-service ./questionmatching.proto
4041
```
4142

4243
This command will generate two files:

apps/proto/go.mod

Lines changed: 0 additions & 15 deletions
This file was deleted.

apps/proto/go.sum

Lines changed: 0 additions & 14 deletions
This file was deleted.

apps/proto/questionmatching.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ syntax = "proto3";
22

33
package questionmatching;
44

5-
option go_package = "./questionmatching";
5+
option go_package = "./proto";
66

77
message MatchQuestionRequest {
88
repeated string matched_topics = 1;

0 commit comments

Comments
 (0)