migrate
This commit is contained in:
parent
bb8ac8edbc
commit
eb2e18c740
@ -36,6 +36,23 @@ services:
|
|||||||
parallelism: 1
|
parallelism: 1
|
||||||
order: start-first
|
order: start-first
|
||||||
|
|
||||||
|
remove:
|
||||||
|
image: mathwave/sprint-repo:battleship-back
|
||||||
|
networks:
|
||||||
|
- battleship-net
|
||||||
|
environment:
|
||||||
|
DB_HOST: "pg.sprinthub.ru"
|
||||||
|
DB_PASSWORD: $DB_PASSWORD_DEV
|
||||||
|
DEBUG: "false"
|
||||||
|
command: ./manage.py remove
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
restart_policy:
|
||||||
|
condition: any
|
||||||
|
update_config:
|
||||||
|
parallelism: 1
|
||||||
|
order: start-first
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
battleship-net:
|
battleship-net:
|
||||||
driver: overlay
|
driver: overlay
|
||||||
|
@ -9,6 +9,8 @@ from battleship.utils import check_field
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def new_game(request):
|
def new_game(request):
|
||||||
|
if request.method == 'OPTIONS':
|
||||||
|
return JsonResponse({})
|
||||||
game = Game.objects.create()
|
game = Game.objects.create()
|
||||||
player1 = Player.objects.create(
|
player1 = Player.objects.create(
|
||||||
game=game,
|
game=game,
|
||||||
@ -28,6 +30,8 @@ def new_game(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def attend_game(request):
|
def attend_game(request):
|
||||||
|
if request.method == 'OPTIONS':
|
||||||
|
return JsonResponse({})
|
||||||
game_id = request.POST['game_id']
|
game_id = request.POST['game_id']
|
||||||
attend_token = request.POST['attend_token']
|
attend_token = request.POST['attend_token']
|
||||||
player = Player.objects.get(game_id=game_id, attend_token=attend_token)
|
player = Player.objects.get(game_id=game_id, attend_token=attend_token)
|
||||||
@ -42,6 +46,8 @@ def attend_game(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def place_ships(request):
|
def place_ships(request):
|
||||||
|
if request.method == 'OPTIONS':
|
||||||
|
return JsonResponse({})
|
||||||
game_id = request.POST['game_id']
|
game_id = request.POST['game_id']
|
||||||
token = request.POST['token']
|
token = request.POST['token']
|
||||||
player = Player.objects.get(game_id=game_id, token=token)
|
player = Player.objects.get(game_id=game_id, token=token)
|
||||||
@ -57,6 +63,8 @@ def place_ships(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def check_opponent(request):
|
def check_opponent(request):
|
||||||
|
if request.method == 'OPTIONS':
|
||||||
|
return JsonResponse({})
|
||||||
game_id = request.POST['game_id']
|
game_id = request.POST['game_id']
|
||||||
token = request.POST['token']
|
token = request.POST['token']
|
||||||
player = Player.objects.get(game_id=game_id, token=token)
|
player = Player.objects.get(game_id=game_id, token=token)
|
||||||
@ -68,6 +76,8 @@ def check_opponent(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def shoot(request):
|
def shoot(request):
|
||||||
|
if request.method == 'OPTIONS':
|
||||||
|
return JsonResponse({})
|
||||||
game_id = request.POST['game_id']
|
game_id = request.POST['game_id']
|
||||||
token = request.POST['token']
|
token = request.POST['token']
|
||||||
player = Player.objects.get(game_id=game_id, token=token)
|
player = Player.objects.get(game_id=game_id, token=token)
|
||||||
@ -105,6 +115,8 @@ def shoot(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def check_status(request):
|
def check_status(request):
|
||||||
|
if request.method == 'OPTIONS':
|
||||||
|
return JsonResponse({})
|
||||||
game_id = request.POST['game_id']
|
game_id = request.POST['game_id']
|
||||||
token = request.POST['token']
|
token = request.POST['token']
|
||||||
player = Player.objects.get(game_id=game_id, token=token)
|
player = Player.objects.get(game_id=game_id, token=token)
|
||||||
@ -117,6 +129,8 @@ def check_status(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def check_field_correct(request):
|
def check_field_correct(request):
|
||||||
|
if request.method == 'OPTIONS':
|
||||||
|
return JsonResponse({})
|
||||||
return JsonResponse({
|
return JsonResponse({
|
||||||
'correct': check_field(request.POST['field'])
|
'correct': check_field(request.POST['field'])
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user