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
04ac49a5
Commit
04ac49a5
authored
Mar 16, 2020
by
Gladys Forte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
{devbugfix} Initial Asset Group and Asset Type Viewsets
parent
0d5dd7ab
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
697 additions
and
374 deletions
+697
-374
app/applicationlayer/ams/asset_group/serializers.py
app/applicationlayer/ams/asset_group/serializers.py
+1
-1
app/applicationlayer/ams/asset_group/table_filters.py
app/applicationlayer/ams/asset_group/table_filters.py
+2
-2
app/applicationlayer/ams/asset_group/views.py
app/applicationlayer/ams/asset_group/views.py
+2
-2
app/applicationlayer/ams/asset_type/serializers.py
app/applicationlayer/ams/asset_type/serializers.py
+11
-0
app/applicationlayer/ams/asset_type/table_filters.py
app/applicationlayer/ams/asset_type/table_filters.py
+9
-0
app/applicationlayer/ams/asset_type/views.py
app/applicationlayer/ams/asset_type/views.py
+80
-0
app/applicationlayer/ams/urls_ams.py
app/applicationlayer/ams/urls_ams.py
+2
-0
app/entities/migrations/0006_auto_20200316_1813.py
app/entities/migrations/0006_auto_20200316_1813.py
+189
-0
app/entities/models.py
app/entities/models.py
+362
-362
requirements/RMSv2.postman_collection.json
requirements/RMSv2.postman_collection.json
+39
-7
No files found.
app/applicationlayer/ams/asset_group/serializers.py
View file @
04ac49a5
...
@@ -6,6 +6,6 @@ from app.applicationlayer.utils import model_to_dict
...
@@ -6,6 +6,6 @@ from app.applicationlayer.utils import model_to_dict
class
AssetGroupSerializer
(
serializers
.
ModelSerializer
):
class
AssetGroupSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
class
Meta
:
model
=
models
.
AssetGroup
model
=
models
.
A
MSA
ssetGroup
fields
=
'__all__'
fields
=
'__all__'
read_only_fields
=
[
'created'
,
'code'
]
read_only_fields
=
[
'created'
,
'code'
]
\ No newline at end of file
app/applicationlayer/ams/asset_group/table_filters.py
View file @
04ac49a5
from
django_filters
import
rest_framework
as
filters
from
django_filters
import
rest_framework
as
filters
from
app.entities.models
import
AssetGroup
from
app.entities.models
import
A
MSA
ssetGroup
class
AssetGroupFilter
(
filters
.
FilterSet
):
class
AssetGroupFilter
(
filters
.
FilterSet
):
class
Meta
:
class
Meta
:
model
=
AssetGroup
model
=
A
MSA
ssetGroup
fields
=
'__all__'
fields
=
'__all__'
\ No newline at end of file
app/applicationlayer/ams/asset_group/views.py
View file @
04ac49a5
...
@@ -15,14 +15,14 @@ from django.db import transaction
...
@@ -15,14 +15,14 @@ from django.db import transaction
class
AssetGroupViewset
(
viewsets
.
ModelViewSet
):
class
AssetGroupViewset
(
viewsets
.
ModelViewSet
):
queryset
=
models
.
AssetGroup
.
objects
.
all
()
queryset
=
models
.
A
MSA
ssetGroup
.
objects
.
all
()
serializer_class
=
serializers
.
AssetGroupSerializer
serializer_class
=
serializers
.
AssetGroupSerializer
pagination_class
=
CustomPagination
pagination_class
=
CustomPagination
lookup_field
=
"code"
lookup_field
=
"code"
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
ordering_fields
=
'__all__'
ordering_fields
=
'__all__'
search_fields
=
(
search_fields
=
(
'code'
,
'name'
,
'asset_group'
'code'
,
'name'
)
)
@
transaction
.
atomic
@
transaction
.
atomic
...
...
app/applicationlayer/ams/asset_type/serializers.py
0 → 100644
View file @
04ac49a5
from
app.entities
import
models
from
rest_framework
import
serializers
from
app.applicationlayer.utils
import
model_to_dict
class
AssetTypeSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
models
.
AMSAssetType
fields
=
'__all__'
read_only_fields
=
[
'created'
,
'code'
]
\ No newline at end of file
app/applicationlayer/ams/asset_type/table_filters.py
0 → 100644
View file @
04ac49a5
from
django_filters
import
rest_framework
as
filters
from
app.entities.models
import
AMSAssetType
class
AssetTypeFilter
(
filters
.
FilterSet
):
class
Meta
:
model
=
AMSAssetType
fields
=
'__all__'
\ No newline at end of file
app/applicationlayer/ams/asset_type/views.py
0 → 100644
View file @
04ac49a5
from
app.entities
import
models
from
rest_framework
import
viewsets
,
status
from
rest_framework.response
import
Response
from
django_filters
import
rest_framework
as
filters
from
django_filters.rest_framework
import
DjangoFilterBackend
from
rest_framework.filters
import
SearchFilter
,
OrderingFilter
from
app.applicationlayer.ams.asset_type.table_filters
import
AssetTypeFilter
from
app.applicationlayer.ams.asset_type
import
serializers
from
app.applicationlayer.utils
import
(
CustomPagination
,
status_message_response
)
from
app.helper
import
decorators
from
django.db
import
transaction
class
AssetTypeViewset
(
viewsets
.
ModelViewSet
):
queryset
=
models
.
AMSAssetType
.
objects
.
all
()
serializer_class
=
serializers
.
AssetTypeSerializer
pagination_class
=
CustomPagination
lookup_field
=
"code"
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
ordering_fields
=
'__all__'
search_fields
=
(
'code'
,
'name'
)
@
transaction
.
atomic
def
create
(
self
,
request
,
*
args
,
**
kwargs
):
serializer
=
self
.
get_serializer
(
data
=
request
.
data
)
serializer
.
is_valid
(
raise_exception
=
True
)
self
.
perform_create
(
serializer
)
message
=
status_message_response
(
201
,
'success'
,
'New Asset Type created'
,
serializer
.
data
)
return
Response
(
message
)
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
page
=
self
.
paginate_queryset
(
queryset
)
if
page
is
not
None
:
serializer
=
self
.
get_serializer
(
page
,
many
=
True
)
message
=
status_message_response
(
200
,
'success'
,
'List of Asset Types found!'
,
serializer
.
data
)
return
self
.
get_paginated_response
(
message
)
serializer
=
self
.
get_serializer
(
self
.
queryset
,
many
=
True
)
return
Response
(
serializer
.
data
,
status
=
status
.
HTTP_200_OK
)
def
retrieve
(
self
,
request
,
*
args
,
**
kwargs
):
instance
=
self
.
get_object
()
serializer
=
self
.
get_serializer
(
instance
)
return
Response
(
serializer
.
data
)
@
transaction
.
atomic
def
destroy
(
self
,
request
,
*
args
,
**
kwargs
):
instance
=
self
.
get_object
()
self
.
perform_destroy
(
instance
)
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
app/applicationlayer/ams/urls_ams.py
View file @
04ac49a5
...
@@ -6,10 +6,12 @@ from rest_framework.urlpatterns import format_suffix_patterns
...
@@ -6,10 +6,12 @@ from rest_framework.urlpatterns import format_suffix_patterns
from
app.applicationlayer.ams.asset_group
import
views
as
assetgroup
from
app.applicationlayer.ams.asset_group
import
views
as
assetgroup
from
app.applicationlayer.ams.ams_privilege
import
views
as
amsprivilege
from
app.applicationlayer.ams.ams_privilege
import
views
as
amsprivilege
from
app.applicationlayer.ams.ams_user_type.views
import
AMSUserTypeViewSet
from
app.applicationlayer.ams.ams_user_type.views
import
AMSUserTypeViewSet
from
app.applicationlayer.ams.asset_type
import
views
as
assettype
router
=
routers
.
DefaultRouter
()
router
=
routers
.
DefaultRouter
()
router
.
register
(
r'asset-group'
,
assetgroup
.
AssetGroupViewset
)
router
.
register
(
r'asset-group'
,
assetgroup
.
AssetGroupViewset
)
router
.
register
(
r'asset-type'
,
assettype
.
AssetTypeViewset
)
router
.
register
(
r'ams-privilege'
,
amsprivilege
.
AMSPrivilegeViewSet
)
router
.
register
(
r'ams-privilege'
,
amsprivilege
.
AMSPrivilegeViewSet
)
urlpatterns
=
[
urlpatterns
=
[
...
...
app/entities/migrations/0006_auto_20200316_1813.py
0 → 100644
View file @
04ac49a5
This diff is collapsed.
Click to expand it.
app/entities/models.py
View file @
04ac49a5
This diff is collapsed.
Click to expand it.
requirements/RMSv2.postman_collection.json
View file @
04ac49a5
...
@@ -802,7 +802,7 @@
...
@@ -802,7 +802,7 @@
],
],
"body"
:
{
"body"
:
{
"mode"
:
"raw"
,
"mode"
:
"raw"
,
"raw"
:
"{
\r\n\t\"
application
\"
:[
\"
APP-20190923-0000002
\"
],
\r\n\t\"
department
\"
:
\"\"
,
\r\n\t\"
user_type
\"
:
\"
OUA
\"
,
\r\n\t\"
name
\"
:
\"
ss
\"
,
\r\n\t\"
username
\"
:
\"
jtc-sereness
\"
,
\r\n\t\"
doa
\"
:
\"\"
,
\r\n\t\"
default_app
\"
:
\"
APP-20190923-0000002
\"
,
\r\n\t\"
contact_no
\"
:
\"
1312313
\"
,
\r\n\t\"
email
\"
:
\"
t@gmail.com
\"\r\n
}
\r\n
"
"raw"
:
"{
\r\n\t\"
application
\"
:[
\"
APP-20190923-0000002
\"
],
\r\n\t\"
department
\"
:
\"
DEPARTMENT-20200122-0000002
\"
,
\r\n\t\"
user_type
\"
:
\"
OUA
\"
,
\r\n\t\"
name
\"
:
\"
ss
\"
,
\r\n\t\"
username
\"
:
\"
jtc-sereness
\"
,
\r\n\t\"
doa
\"
:
\"\"
,
\r\n\t\"
default_app
\"
:
\"
APP-20190923-0000002
\"
,
\r\n\t\"
contact_no
\"
:
\"
1312313
\"
,
\r\n\t\"
email
\"
:
\"
t@gmail.com
\"\r\n
}
\r\n
"
},
},
"url"
:
{
"url"
:
{
"raw"
:
"{{baseurl}}/management/users/"
,
"raw"
:
"{{baseurl}}/management/users/"
,
...
@@ -832,17 +832,17 @@
...
@@ -832,17 +832,17 @@
],
],
"body"
:
{
"body"
:
{
"mode"
:
"raw"
,
"mode"
:
"raw"
,
"raw"
:
"{
\r\n\t\"
application
\"
:[
\"
APP-201909
17-0000001
\"
,
\"
APP-20190917-0000003
\"
],
\r\n\t\"
department
\"
:
\"
DEPARTMENT-20190917-0000002
\"
,
\r\n\t\"
user_type
\"
:
\"
OUA
\"
,
\r\n\t\"
name
\"
:
\"
Ritas
\"
,
\r\n\t\"
username
\"
:
\"
obrit1a
\"
,
\r\n\t\"
doa
\"
:
\"\"
,
\r\n\t\"
default_app
\"
:
\"
APP-20190917
-0000001
\"
,
\r\n\t\"
contact_no
\"
:
\"
1312313
\"
,
\r\n\t\"
email
\"
:
\"
test@gmail.com
\"\r\n
}
\r\n
"
"raw"
:
"{
\r\n\t\"
application
\"
:[
\"
APP-201909
23-0000001
\"
],
\r\n\t\"
department
\"
:
\"
DEPARTMENT-20200122-0000002
\"
,
\r\n\t\"
user_type
\"
:
\"
OUA
\"
,
\r\n\t\"
name
\"
:
\"
Ritas
\"
,
\r\n\t\"
username
\"
:
\"
obrita
\"
,
\r\n\t\"
doa
\"
:
\"\"
,
\r\n\t\"
default_app
\"
:
\"
APP-20190923
-0000001
\"
,
\r\n\t\"
contact_no
\"
:
\"
1312313
\"
,
\r\n\t\"
email
\"
:
\"
test@gmail.com
\"\r\n
}
\r\n
"
},
},
"url"
:
{
"url"
:
{
"raw"
:
"{{baseurl}}/management/users/USER-20
190919-0000028
/"
,
"raw"
:
"{{baseurl}}/management/users/USER-20
200122-0000002
/"
,
"host"
:
[
"host"
:
[
"{{baseurl}}"
"{{baseurl}}"
],
],
"path"
:
[
"path"
:
[
"management"
,
"management"
,
"users"
,
"users"
,
"USER-20
190919-0000028
"
,
"USER-20
200122-0000002
"
,
""
""
]
]
}
}
...
@@ -3461,7 +3461,7 @@
...
@@ -3461,7 +3461,7 @@
"method"
:
"GET"
,
"method"
:
"GET"
,
"header"
:
[],
"header"
:
[],
"url"
:
{
"url"
:
{
"raw"
:
"{{baseurl}}/asset-management/ams-privilege/"
,
"raw"
:
"{{baseurl}}/asset-management/ams-privilege/
?id_number=USER-20200311-0000007
"
,
"host"
:
[
"host"
:
[
"{{baseurl}}"
"{{baseurl}}"
],
],
...
@@ -3469,6 +3469,12 @@
...
@@ -3469,6 +3469,12 @@
"asset-management"
,
"asset-management"
,
"ams-privilege"
,
"ams-privilege"
,
""
""
],
"query"
:
[
{
"key"
:
"id_number"
,
"value"
:
"USER-20200311-0000007"
}
]
]
}
}
},
},
...
@@ -3481,7 +3487,7 @@
...
@@ -3481,7 +3487,7 @@
"header"
:
[],
"header"
:
[],
"body"
:
{
"body"
:
{
"mode"
:
"raw"
,
"mode"
:
"raw"
,
"raw"
:
"{
\n\t\"
body_data
\"
: [
\n
{
\n
\"
id_number
\"
:
\"
USER-20200122-0000002
\"
,
\n
\"
department
\"
:
\"
DEPARTMENT-20200122-0000003
\"
,
\n
\"
ams_user_type
\"
:
\"
MANAGER
\"\n
},
\n
{
\n
\"
id_number
\"
:
\"
USER-20200122-0000002
\"
,
\n
\"
department
\"
:
\"
DEPARTMENT-20200122-0000002
\"
,
\n
\"
ams_user_type
\"
:
\"
USER_CLIENT
\"\n
}
\n
]
\n
}"
,
"raw"
:
"{
\n\t\"
form
\"
: [
\n
{
\n
\"
id_number
\"
:
\"
USER-20200310-0000016
\"
,
\n
\"
department
\"
:
\"
DEPARTMENT-20200218-0000003
\"
,
\n
\"
ams_user_type
\"
:
\"
MANAGER
\"\n
},
\n
{
\n
\"
id_number
\"
:
\"
USER-20200310-0000016
\"
,
\n
\"
department
\"
:
\"
DEPARTMENT-20200211-0000002
\"
,
\n
\"
ams_user_type
\"
:
\"
MANAGER
\"\n
}
\n
]
\n
}"
,
"options"
:
{
"options"
:
{
"raw"
:
{
"raw"
:
{
"language"
:
"json"
"language"
:
"json"
...
@@ -3636,6 +3642,32 @@
...
@@ -3636,6 +3642,32 @@
],
],
"protocolProfileBehavior"
:
{},
"protocolProfileBehavior"
:
{},
"_postman_isSubFolder"
:
true
"_postman_isSubFolder"
:
true
},
{
"name"
:
"Asset Type"
,
"item"
:
[
{
"name"
:
"List of Asset Type"
,
"request"
:
{
"method"
:
"GET"
,
"header"
:
[],
"url"
:
{
"raw"
:
"{{baseurl}}/asset-management/asset-type/"
,
"host"
:
[
"{{baseurl}}"
],
"path"
:
[
"asset-management"
,
"asset-type"
,
""
]
}
},
"response"
:
[]
}
],
"protocolProfileBehavior"
:
{},
"_postman_isSubFolder"
:
true
}
}
],
],
"protocolProfileBehavior"
:
{}
"protocolProfileBehavior"
:
{}
...
@@ -3646,7 +3678,7 @@
...
@@ -3646,7 +3678,7 @@
"bearer"
:
[
"bearer"
:
[
{
{
"key"
:
"token"
,
"key"
:
"token"
,
"value"
:
"
4a6d5d4ce95b759f2718e64878d4be38d257022b
"
,
"value"
:
"
6b7ae14960a219fb1dcc17768de07a4ccff58fe4
"
,
"type"
:
"string"
"type"
:
"string"
}
}
]
]
...
...
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