-
cd backend python3 -m venv venv source venv/bin/activate
-
pip install -r requirements.txt prisma generate
-
sudo docker run --name pgdb -e POSTGRES_PASSWORD=12345678 -d -p 5432:5432 postgres
- P.S. ΠΡΠ»ΠΈ Π΄ΠΎ ΡΡΠΎΠ³ΠΎ ΡΠΆΠ΅ Π·Π°ΠΏΡΡΠΊΠ°Π»ΠΈ
sudo docker run -e POSTGRES_PASSWORD=12345678 -d -p 5432:5432 postgres
- ΠΠΈΠ³ΡΠ°ΡΠΈΡ
python3 -m prisma migrate dev
-
python3 -m prisma studio
- ΠΡΠΊΡΡΠ²Π°Π΅ΠΌ http://localhost:5555
-
python3 -m uvicorn api.index:app
- ΠΡΠΊΡΡΠ²Π°Π΅ΠΌ http://localhost:8000/docs
- ΠΠ°ΠΏΡΠΎΡ/ΠΡΠ²Π΅Ρ
- ΠΡ ΠΎΠ΄Π½ΡΠ΅ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΡ
- ΠΡΠΎΠ²Π΅ΡΠΊΠΈ
- ΠΡΡ ΠΎΠ΄Π½ΡΠ΅ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΡ
- ΠΠΎΠ»ΠΎΠΆΠΈΡΠ΅Π»ΡΠ½ΡΠΉ ΠΎΡΠ²Π΅Ρ
- ΠΡΠ²Π΅Ρ Ρ ΠΎΡΠΈΠ±ΠΊΠ°ΠΌΠΈ
- ΠΠΏΠΈΡΠ°Π½ΠΈΠ΅ ΠΈΠ½ΡΠ΅Π³ΡΠ°ΡΠΈΠΈ
- /user/{user_id}
- POST
- input:
user_id (integer)
- output:
{
"id": 0,
"games": [
"string"
]
}
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}
- /user/{user_id}/games
- GET
- input:
user_id (integer)
- output:
[
{
"id": 0,
"owner": {
"id": 0,
"games": [
"string"
]
},
"ownerId": 0,
"logoURL": "string",
"background": 0,
"welcomeTitle": "string",
"welcomeBody": "string",
"subject": "string",
"leaveTitle": "string",
"leaveBody": "string",
"leaveURL": "string",
"gameType": "CLASSIC",
"classicCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"term": "string",
"description": "string"
}
],
"rounds": 0,
"matchCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"imageURL": "string",
"name": "string",
"description": "string"
}
]
}
]
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}
- /game/{game_id}
- GET
- input:
game_id (integer)
- output:
{
"id": 0,
"owner": {
"id": 0,
"games": [
"string"
]
},
"ownerId": 0,
"logoURL": "string",
"background": 0,
"welcomeTitle": "string",
"welcomeBody": "string",
"subject": "string",
"leaveTitle": "string",
"leaveBody": "string",
"leaveURL": "string",
"gameType": "CLASSIC",
"classicCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"term": "string",
"description": "string"
}
],
"rounds": 0,
"matchCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"imageURL": "string",
"name": "string",
"description": "string"
}
]
}
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}
- /game/{game_id}
- DELETE
- input:
game_id (integer)
- output:
{
"cardsDeleted": 0,
"deletedGame": {
"id": 0,
"owner": {
"id": 0,
"games": [
"string"
]
},
"ownerId": 0,
"logoURL": "string",
"background": 0,
"welcomeTitle": "string",
"welcomeBody": "string",
"subject": "string",
"leaveTitle": "string",
"leaveBody": "string",
"leaveURL": "string",
"gameType": "CLASSIC",
"classicCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"term": "string",
"description": "string"
}
],
"rounds": 0,
"matchCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"imageURL": "string",
"name": "string",
"description": "string"
}
]
}
}
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}
- /game/{game_id}
- PUT
- input:
game_id (integer)
{
"logoURL": "string",
"background": 0,
"welcomeTitle": "string",
"welcomeBody": "string",
"subject": "string",
"leaveTitle": "string",
"leaveBody": "string",
"leaveURL": "string",
"rounds": 0
}
- output:
{
"id": 0,
"owner": {
"id": 0,
"games": [
"string"
]
},
"ownerId": 0,
"logoURL": "string",
"background": 0,
"welcomeTitle": "string",
"welcomeBody": "string",
"subject": "string",
"leaveTitle": "string",
"leaveBody": "string",
"leaveURL": "string",
"gameType": "CLASSIC",
"classicCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"term": "string",
"description": "string"
}
],
"rounds": 0,
"matchCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"imageURL": "string",
"name": "string",
"description": "string"
}
]
}
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}
- /game
- POST
- input:
{
"ownerId": 0,
"logoURL": "string",
"background": 0,
"welcomeTitle": "string",
"welcomeBody": "string",
"subject": "string",
"leaveTitle": "string",
"leaveBody": "string",
"leaveURL": "string",
"gameType": "CLASSIC",
"classicCards": [],
"rounds": 0,
"matchCards": []
}
- output:
{
"id": 0,
"owner": {
"id": 0,
"games": [
"string"
]
},
"ownerId": 0,
"logoURL": "string",
"background": 0,
"welcomeTitle": "string",
"welcomeBody": "string",
"subject": "string",
"leaveTitle": "string",
"leaveBody": "string",
"leaveURL": "string",
"gameType": "CLASSIC",
"classicCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"term": "string",
"description": "string"
}
],
"rounds": 0,
"matchCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"imageURL": "string",
"name": "string",
"description": "string"
}
]
}
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}
- /classiccard
- POST
- input:
{
"term": "string",
"description": "string",
"gameId": 0
}
- output:
{
"id": 0,
"game": "string",
"gameId": 0,
"term": "string",
"description": "string"
}
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}
- /classiccard/{card_id}
- DELETE
- input:
card_id (integer)
- output:
{
"id": 0,
"game": "string",
"gameId": 0,
"term": "string",
"description": "string"
}
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}
- /classiccard/{card_id}
- PUT
- input:
card_id(int)
{
"term": "string",
"description": "string"
}
- output:
{
"id": 0,
"game": "string",
"gameId": 0,
"term": "string",
"description": "string"
}
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}
- /matchcard
- POST
- input:
{
"imageURL": "string",
"name": "string",
"description": "string",
"gameId": 0
}
- output:
{
"id": 0,
"game": {
"id": 0,
"owner": {
"id": 0,
"games": [
"string"
]
},
"ownerId": 0,
"logoURL": "string",
"background": 0,
"welcomeTitle": "string",
"welcomeBody": "string",
"subject": "string",
"leaveTitle": "string",
"leaveBody": "string",
"leaveURL": "string",
"gameType": "CLASSIC",
"classicCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"term": "string",
"description": "string"
}
],
"rounds": 0,
"matchCards": [
"string"
]
},
"gameId": 0,
"imageURL": "string",
"name": "string",
"description": "string"
}
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}
- /matchcard/{card_id}
- DELETE
- input:
card_id(int)
- output:
{
"id": 0,
"game": {
"id": 0,
"owner": {
"id": 0,
"games": [
"string"
]
},
"ownerId": 0,
"logoURL": "string",
"background": 0,
"welcomeTitle": "string",
"welcomeBody": "string",
"subject": "string",
"leaveTitle": "string",
"leaveBody": "string",
"leaveURL": "string",
"gameType": "CLASSIC",
"classicCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"term": "string",
"description": "string"
}
],
"rounds": 0,
"matchCards": [
"string"
]
},
"gameId": 0,
"imageURL": "string",
"name": "string",
"description": "string"
}
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}
- /matchcard/{card_id}
- PUT
- input:
{
"imageURL": "string",
"name": "string",
"description": "string"
}
- output:
{
"id": 0,
"game": {
"id": 0,
"owner": {
"id": 0,
"games": [
"string"
]
},
"ownerId": 0,
"logoURL": "string",
"background": 0,
"welcomeTitle": "string",
"welcomeBody": "string",
"subject": "string",
"leaveTitle": "string",
"leaveBody": "string",
"leaveURL": "string",
"gameType": "CLASSIC",
"classicCards": [
{
"id": 0,
"game": "string",
"gameId": 0,
"term": "string",
"description": "string"
}
],
"rounds": 0,
"matchCards": [
"string"
]
},
"gameId": 0,
"imageURL": "string",
"name": "string",
"description": "string"
}
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}