-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.txt
More file actions
96 lines (68 loc) · 2.41 KB
/
task.txt
File metadata and controls
96 lines (68 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Microservices
This project consists of microservices for managing users, quests, rewards, and assigning quests using FastAPI. Each service runs independently and communicates through an API Gateway. Docker is used to containerize the microservices.
## Getting Started
### Prerequisites
- Docker
- Docker Compose
### Running the Services
To start all the microservices using Docker Compose:
```bash
docker-compose up --build
This will build the images and start the following services:
• API Gateway (Port: 8000)
• User Authentication Service (Port: 8001)
• Quest Catalog Service (Port: 8002)
• Quest Processing Service (Port: 8003)
API Usage
Once the services are running, you can interact with them via the following API endpoints:
1. Create Reward
To create a new reward, use the following cURL command:
curl -X POST http://localhost:8000/rewards/ \
-H "Content-Type: application/json" \
-d '{
"reward_name": "Diamonds",
"reward_item": "diamond",
"reward_qty": 10
}'
2. Create Quest
To create a quest and link it to a reward:
curl -X POST http://localhost:8000/quests/ \
-H "Content-Type: application/json" \
-d '{
"reward_id": 1,
"auto_claim": true,
"streak": 3,
"duplication": 1,
"name": "Sign-In-Three-Times",
"description": "Log in to the platform three times to receive a reward of 10 diamonds."
}'
3. Assign Quest to User
To assign a quest to a specific user:
curl -X POST http://localhost:8000/assign-quest/ \
-H "Content-Type: application/json" \
-d '{
"user_id": 1,
"quest_id": 1
}'
4. Signup User
To register a new user:
curl -X POST "http://localhost:8001/signup" \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"password": "password123"
}'
5. Login User
To log in an existing user:
curl -X POST "http://localhost:8001/login" \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"password": "password123"
}'
Accessing Documentation
You can access the Swagger UI for each microservice using the following URLs:
• API Gateway: http://localhost:8000/docs
• Auth Service: http://localhost:8001/docs
• Quest Catalog Service: http://localhost:8002/docs
• Quest Processing Service: http://localhost:8003/docs