Exemplo n.º 1
0
 def put(self, game_id, column_number):
     """ Column Play """
     color = 'player_red'
     try:
         column_number = int(column_number)
     except ValueError:
         return {
             'message': f'Column {column_number} is not a number! '
         }, 400
     if not 0 <= column_number <= 6:
         return {
             'message': f'Column {column_number} is not a valid play! '
         }, 400
     else:
         return Games().update_player_move(game_id, color, column_number)
Exemplo n.º 2
0
 def get(self, title):
     ''' Returns a game title name '''
     return Games().get_one(title)
Exemplo n.º 3
0
 def post(self):
     ''' Creates a game '''
     return Games().create_one(request.get_json())
Exemplo n.º 4
0
 def get(self):
     ''' Returns list of games '''
     return Games().get_all()
Exemplo n.º 5
0
 def get(self):
     ''' returns a list of all fields in games '''
     return Games().get_all()
Exemplo n.º 6
0
 def delete(self, game_id):
     ''' deletes a game by game Id '''
     return Games().delete_one(game_id)
Exemplo n.º 7
0
 def put(self, game_id):
     ''' updates a game by game Id '''
     print('putprint')
     return Games().update_one(game_id, request.json)
Exemplo n.º 8
0
 def put(self, game_id, player_id):
     """ Assigns GameID to Player Red """
     color = 'player_red'
     return Games().update_game_player(game_id, color, player_id)
Exemplo n.º 9
0
 def post(self):
     ''' adds a new game '''
     print(f'request={request.get_json()}')
     return Games().create_one(request.get_json())
Exemplo n.º 10
0
 def delete(self, game_id):
     """ Deletes Game by Id number """
     return Games().delete_one(game_id)
Exemplo n.º 11
0
 def put(self, game_id):
     """ Updates Game by Id number """
     return Games().update_one(game_id, request.json)
Exemplo n.º 12
0
 def get(self, game_id):
     """ Returns Game by Id number """
     return Games().get_one(game_id)
Exemplo n.º 13
0
 def post(self):
     """ Creates a new Game """
     return Games().create_one(request.get_json())
Exemplo n.º 14
0
 def get(self):
     """ Returns List of Games """
     args = GET_PARSER.parse_args()
     return Games().get_all(args["status"])
Exemplo n.º 15
0
 def put(self, title):
     ''' Updates a game title name '''
     return Games().update_one(title, request.json)
Exemplo n.º 16
0
 def get(self, game_id):
     ''' gets a game by game Id '''
     return Games().get_one(game_id)
Exemplo n.º 17
0
 def delete(self, title):
     ''' Deletes a game by title name '''
     return Games().delete_one(title)
Exemplo n.º 18
0
 def put(self, game_id, player_id):
     """ Assigns GameID to Player Yellow """
     color = 'player_yellow'
     return Games().update_game_player(game_id, color, player_id)