Skip to content

ilkatkov/vkgame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

81 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Запуск Π‘Π” Ρ‡Π΅Ρ€Π΅Π· Π΄ΠΎΠΊΠ΅Ρ€

Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Π²ΠΈΡ€Ρ‚ΡƒΠ°Π»ΡŒΠ½ΠΎΠΉ срСды

  • 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

ΠŸΡ€ΠΎΠ²Π΅Ρ€ΠΊΠ° Ρ€Π°Π±ΠΎΡ‚Ρ‹ Π‘Π”

Запуск API

API Запросы

Основная информация

  • Запрос/ΠžΡ‚Π²Π΅Ρ‚
  • Π’Ρ…ΠΎΠ΄Π½Ρ‹Π΅ ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹
  • ΠŸΡ€ΠΎΠ²Π΅Ρ€ΠΊΠΈ
  • Π’Ρ‹Ρ…ΠΎΠ΄Π½Ρ‹Π΅ ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹
  • ΠŸΠΎΠ»ΠΎΠΆΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹ΠΉ ΠΎΡ‚Π²Π΅Ρ‚
  • ΠžΡ‚Π²Π΅Ρ‚ с ошибками
  • ОписаниС ΠΈΠ½Ρ‚Π΅Π³Ρ€Π°Ρ†ΠΈΠΈ

Create user

  • /user/{user_id}
  • POST
  • input:
user_id (integer)
  • output:

🟒 Successful Response(200):

{
	"id": 0,
	"games": [
		"string"
	]
}

πŸ”΄ Validation Error(422):

{
"detail": [
		{
		"loc": [
			"string",
			0
		],
		"msg": "string",
		"type": "string"
		}
]
}

Get Owned Games

  • /user/{user_id}/games
  • GET
  • input:
user_id (integer)
  • output:

🟒 Successful Response:

[
  {
    "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"
      }
    ]
  }
]

πŸ”΄ Validation Error(422):

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Get Game

  • /game/{game_id}
  • GET
  • input:
game_id (integer)
  • output:

🟒 Successful Response(200):

{
  "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"
    }
  ]
}

πŸ”΄ Validation Error(422):

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Delete Game

  • /game/{game_id}
  • DELETE
  • input:
game_id (integer)
  • output:

🟒 Successful Response(200):

{
  "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"
      }
    ]
  }
}

πŸ”΄ Validation Error(422):

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Modify Game

  • /game/{game_id}
  • PUT
  • input:
game_id (integer)

Request body (application/json)

{
  "logoURL": "string",
  "background": 0,
  "welcomeTitle": "string",
  "welcomeBody": "string",
  "subject": "string",
  "leaveTitle": "string",
  "leaveBody": "string",
  "leaveURL": "string",
  "rounds": 0
}
  • output:

🟒 Successful Response(200):

{
  "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"
    }
  ]
}

πŸ”΄ Validation Error(422):

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Create Game

  • /game
  • POST
  • input:

Request body (application/json)

{
  "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:

🟒 Successful Response(201):

{
  "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"
    }
  ]
}

πŸ”΄ Validation Error(422):

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Create Classic Card

  • /classiccard
  • POST
  • input:

Request body (application/json)

{
  "term": "string",
  "description": "string",
  "gameId": 0
}
  • output:

🟒 Successful Response(200):

{
  "id": 0,
  "game": "string",
  "gameId": 0,
  "term": "string",
  "description": "string"
}

πŸ”΄ Validation Error(422):

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Delete Classic Card

  • /classiccard/{card_id}
  • DELETE
  • input:
card_id (integer)
  • output:

🟒 Successful Response(200):

{
  "id": 0,
  "game": "string",
  "gameId": 0,
  "term": "string",
  "description": "string"
}

πŸ”΄ Validation Error(422):

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Modify Classic Card

  • /classiccard/{card_id}
  • PUT
  • input:
card_id(int)

Request_body (application/json)

{
  "term": "string",
  "description": "string"
}
  • output:

🟒 Successful Response(200):

{
  "id": 0,
  "game": "string",
  "gameId": 0,
  "term": "string",
  "description": "string"
}

πŸ”΄ Validation Error(422):

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Create Match Card

  • /matchcard
  • POST
  • input:

Request_body (application/json):

{
  "imageURL": "string",
  "name": "string",
  "description": "string",
  "gameId": 0
}
  • output:

🟒 Successful Response(200):

{
  "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"
}

πŸ”΄ Validation Error(422):

 {
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Delete Match Card

  • /matchcard/{card_id}
  • DELETE
  • input:
card_id(int)
  • output:

🟒 Successful Response(200):

{
  "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"
}

πŸ”΄ Validation Error(422):

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Modify Match Card

  • /matchcard/{card_id}
  • PUT
  • input:

Request_body (application/json)

{
  "imageURL": "string",
  "name": "string",
  "description": "string"
}
  • output:

🟒 Successful Response(200):

{
  "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"
}

πŸ”΄ Validation Error(422):

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •