A api update

pull/22/head
雷二猛 2019-12-21 12:36:40 +08:00
parent cf5bfc81bb
commit f9365b3e37
2 changed files with 26 additions and 14 deletions

View File

@ -4,5 +4,5 @@ from .views import *
urlpatterns = [ urlpatterns = [
path('request/', RequestView.as_view()), path('request/', RequestView.as_view()),
path('request/<int:r_id>/', do_deploy), path('request/<int:r_id>/', RequestDetailView.as_view()),
] ]

View File

@ -58,7 +58,19 @@ class RequestView(View):
return json_response(error=error) return json_response(error=error)
def do_deploy(request, r_id): class RequestDetailView(View):
def get(self, request, r_id):
req = DeployRequest.objects.filter(pk=r_id).first()
if not req:
return json_response(error='为找到指定发布申请')
return json_response({
'app_name': req.app.name,
'env_name': req.app.env.name,
'status': req.status,
'status_alias': req.get_status_display()
})
def post(self, request, r_id):
req = DeployRequest.objects.filter(pk=r_id).first() req = DeployRequest.objects.filter(pk=r_id).first()
if not req: if not req:
return json_response(error='未找到指定发布申请') return json_response(error='未找到指定发布申请')