Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
00bf648d
Commit
00bf648d
authored
Jul 09, 2019
by
Ristylou Dolar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified Service and Endpoint fk - object
parent
2c753af2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
api/serializers.py
api/serializers.py
+1
-2
api/viewsets/endpoints.py
api/viewsets/endpoints.py
+7
-1
api/viewsets/services.py
api/viewsets/services.py
+7
-1
No files found.
api/serializers.py
View file @
00bf648d
...
...
@@ -118,12 +118,11 @@ class APIServiceSerializer(serializers.ModelSerializer):
class
APIEndpointSerializer
(
serializers
.
ModelSerializer
):
service_name
=
serializers
.
ReadOnlyField
(
source
=
'service.name'
)
class
Meta
:
model
=
APIEndpoint
fields
=
(
'id'
,
'api_endpoint_no'
,
'service'
,
'
service_name'
,
'
name'
,
'id'
,
'api_endpoint_no'
,
'service'
,
'name'
,
'description'
,
'http_method'
,
'endpoint_url'
,
'is_need_auth'
,
'is_active'
,
'created_at'
,
'updated_at'
,
'deleted_at'
)
...
...
api/viewsets/endpoints.py
View file @
00bf648d
from
rest_framework
import
viewsets
,
status
from
rest_framework.decorators
import
action
from
rest_framework.response
import
Response
from
api.models
import
APIEndpoint
from
api.models
import
APIEndpoint
,
APIService
from
api.serializers
import
APIEndpointSerializer
from
api.utils
import
(
CustomPagination
,
BadRequestException
,
...
...
@@ -78,6 +78,12 @@ class APIEndpointViewSet(viewsets.ModelViewSet):
page
=
self
.
paginate_queryset
(
queryset
)
if
page
is
not
None
:
serializer
=
self
.
get_serializer
(
page
,
many
=
True
)
enp_data
=
serializer
.
data
for
service
in
enp_data
:
svc_values
=
APIService
.
objects
.
filter
(
id
=
service
[
'service'
])
.
values
()
service
[
'service'
]
=
svc_values
[
0
]
message
=
{
'code'
:
200
,
'status'
:
'success'
,
...
...
api/viewsets/services.py
View file @
00bf648d
from
rest_framework
import
viewsets
,
status
from
rest_framework.decorators
import
action
from
rest_framework.response
import
Response
from
api.models
import
APIService
from
api.models
import
APIService
,
Application
from
api.serializers
import
APIServiceSerializer
from
api.utils
import
(
CustomPagination
,
BadRequestException
,
...
...
@@ -80,6 +80,12 @@ class APIServiceViewSet(viewsets.ModelViewSet):
page
=
self
.
paginate_queryset
(
queryset
)
if
page
is
not
None
:
serializer
=
self
.
get_serializer
(
page
,
many
=
True
)
svc_data
=
serializer
.
data
for
application
in
svc_data
:
app_values
=
Application
.
objects
.
filter
(
id
=
application
[
'application'
])
.
values
()
application
[
'application'
]
=
app_values
[
0
]
message
=
{
'code'
:
200
,
'status'
:
'success'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment