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
e15e62b2
Commit
e15e62b2
authored
Sep 17, 2019
by
John Red Medrano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace all slug on management section with code
parent
f10766e7
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
3236 additions
and
2318 deletions
+3236
-2318
app/applicationlayer/management/account/serializer.py
app/applicationlayer/management/account/serializer.py
+3
-3
app/applicationlayer/management/account/views.py
app/applicationlayer/management/account/views.py
+3
-2
app/applicationlayer/management/application/views.py
app/applicationlayer/management/application/views.py
+1
-0
app/applicationlayer/management/company/views.py
app/applicationlayer/management/company/views.py
+1
-0
app/applicationlayer/management/department/views.py
app/applicationlayer/management/department/views.py
+1
-0
app/applicationlayer/management/module/views.py
app/applicationlayer/management/module/views.py
+1
-0
app/entities/migrations/0001_initial.py
app/entities/migrations/0001_initial.py
+55
-25
app/entities/migrations/0002_remove_application_app_code.py
app/entities/migrations/0002_remove_application_app_code.py
+0
-17
app/entities/migrations/0003_auto_20190910_0956.py
app/entities/migrations/0003_auto_20190910_0956.py
+0
-23
app/entities/migrations/0004_auto_20190910_1610.py
app/entities/migrations/0004_auto_20190910_1610.py
+0
-18
app/entities/migrations/0005_emaillogs.py
app/entities/migrations/0005_emaillogs.py
+0
-29
app/entities/migrations/0006_emaillogs_is_sent.py
app/entities/migrations/0006_emaillogs_is_sent.py
+0
-18
app/entities/migrations/0007_auto_20190911_1026.py
app/entities/migrations/0007_auto_20190911_1026.py
+0
-17
app/entities/migrations/0007_auto_20190911_1102.py
app/entities/migrations/0007_auto_20190911_1102.py
+0
-18
app/entities/migrations/0008_auto_20190911_1715.py
app/entities/migrations/0008_auto_20190911_1715.py
+0
-18
app/entities/migrations/0008_passwordreset.py
app/entities/migrations/0008_passwordreset.py
+0
-28
app/entities/migrations/0009_auto_20190911_1845.py
app/entities/migrations/0009_auto_20190911_1845.py
+0
-63
app/entities/migrations/0010_auto_20190913_1143.py
app/entities/migrations/0010_auto_20190913_1143.py
+0
-33
app/entities/migrations/0011_merge_20190913_1545.py
app/entities/migrations/0011_merge_20190913_1545.py
+0
-14
app/entities/migrations/0012_auto_20190913_1704.py
app/entities/migrations/0012_auto_20190913_1704.py
+0
-18
app/entities/models.py
app/entities/models.py
+22
-5
app/helper/decorators.py
app/helper/decorators.py
+1
-1
requirements/RMSv2.postman_collection_091619
requirements/RMSv2.postman_collection_091619
+2085
-1968
requirements/rms_17092019.sql
requirements/rms_17092019.sql
+1063
-0
No files found.
app/applicationlayer/management/account/serializer.py
View file @
e15e62b2
...
...
@@ -9,12 +9,12 @@ from django.forms.models import model_to_dict
class
UserSerializer
(
serializers
.
ModelSerializer
):
def
to_representation
(
self
,
instance
):
# department = serializers.CharField(write_only=True)
def
to_representation
(
self
,
instance
):
ret
=
super
()
.
to_representation
(
instance
)
ret
[
'department'
]
=
model_to_dict
(
instance
.
department
)
ret
[
'company'
]
=
model_to_dict
(
instance
.
department
.
company
)
# print(instance.application.all())
application
=
[
data
[
'id'
]
for
data
in
instance
.
application
.
values
()]
ret
[
'application'
]
=
application
...
...
@@ -27,7 +27,7 @@ class UserSerializer(serializers.ModelSerializer):
'username'
,
'contact_no'
,
'email'
,
'default_app'
,
'user_type'
,
'is_active'
,
'doa'
'doa'
,
'department'
)
...
...
app/applicationlayer/management/account/views.py
View file @
e15e62b2
...
...
@@ -30,7 +30,7 @@ class UserViewSet(viewsets.ModelViewSet):
queryset
=
User
.
objects
.
all
()
serializer_class
=
serializer
.
UserSerializer
pagination_class
=
CustomPagination
#
lookup_field = 'code'
lookup_field
=
'code'
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filterset_class
=
UserFilterSet
ordering_fields
=
'__all__'
...
...
@@ -53,13 +53,14 @@ class UserViewSet(viewsets.ModelViewSet):
password_hash
=
make_password
(
password
)
app
=
Application
.
objects
.
filter
(
id
__in
=
request
.
data
[
'application'
]
code
__in
=
request
.
data
[
'application'
]
)
instance
=
User
.
objects
.
get
(
id
=
serializer
.
data
[
'id'
]
)
instance
.
application
.
set
(
app
)
User
.
objects
.
filter
(
...
...
app/applicationlayer/management/application/views.py
View file @
e15e62b2
...
...
@@ -19,6 +19,7 @@ class ApplicationViewSet(viewsets.ModelViewSet):
queryset
=
Application
.
objects
.
all
()
serializer_class
=
serializer
.
ApplicationSerializer
pagination_class
=
CustomPagination
lookup_field
=
'code'
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filterset_class
=
ApplicationFilterSet
ordering_fields
=
'__all__'
...
...
app/applicationlayer/management/company/views.py
View file @
e15e62b2
...
...
@@ -19,6 +19,7 @@ class CompanyViewSet(viewsets.ModelViewSet):
queryset
=
Company
.
objects
.
all
()
serializer_class
=
serializer
.
CompanySerializer
pagination_class
=
CustomPagination
lookup_field
=
'code'
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filterset_class
=
CompanyFilterSet
ordering_fields
=
'__all__'
...
...
app/applicationlayer/management/department/views.py
View file @
e15e62b2
...
...
@@ -19,6 +19,7 @@ class DepartmentViewSet(viewsets.ModelViewSet):
queryset
=
Department
.
objects
.
all
()
serializer_class
=
serializer
.
DepartmentSerializer
pagination_class
=
CustomPagination
lookup_field
=
'code'
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filterset_class
=
DepartmentFilterSet
ordering_fields
=
'__all__'
...
...
app/applicationlayer/management/module/views.py
View file @
e15e62b2
...
...
@@ -21,6 +21,7 @@ class ModuleViewSet(viewsets.ModelViewSet):
queryset
=
Module
.
objects
.
order_by
(
'application'
,
'parent'
,
'sort_id'
)
serializer_class
=
serializer
.
ModuleSerializer
pagination_class
=
CustomPagination
lookup_field
=
'code'
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filterset_class
=
ModuleFilterSet
ordering_fields
=
'__all__'
...
...
app/entities/migrations/0001_initial.py
View file @
e15e62b2
This diff is collapsed.
Click to expand it.
app/entities/migrations/0002_remove_application_app_code.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-09 17:14
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0001_initial'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'application'
,
name
=
'app_code'
,
),
]
app/entities/migrations/0003_auto_20190910_0956.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-10 09:56
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0002_remove_application_app_code'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'changerequestformheader'
,
name
=
'requested_to_template_id'
,
field
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
),
),
migrations
.
AlterField
(
model_name
=
'changerequesttemplateheader'
,
name
=
'requested_to_template_id'
,
field
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
),
),
]
app/entities/migrations/0004_auto_20190910_1610.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-10 16:10
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0003_auto_20190910_0956'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'module'
,
name
=
'parent'
,
field
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
),
),
]
app/entities/migrations/0005_emaillogs.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-10 16:56
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0004_auto_20190910_1610'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'EmailLogs'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'created'
,
models
.
DateTimeField
(
auto_now_add
=
True
)),
(
'createdby'
,
models
.
CharField
(
max_length
=
255
)),
(
'modified'
,
models
.
DateTimeField
(
auto_now
=
True
)),
(
'modifiedby'
,
models
.
CharField
(
max_length
=
255
)),
(
'template'
,
models
.
CharField
(
max_length
=
255
)),
(
'recipients'
,
models
.
CharField
(
max_length
=
255
)),
(
'content'
,
models
.
TextField
()),
],
options
=
{
'abstract'
:
False
,
},
),
]
app/entities/migrations/0006_emaillogs_is_sent.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-10 17:02
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0005_emaillogs'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'emaillogs'
,
name
=
'is_sent'
,
field
=
models
.
BooleanField
(
default
=
True
),
),
]
app/entities/migrations/0007_auto_20190911_1026.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-11 10:26
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0006_emaillogs_is_sent'
),
]
operations
=
[
migrations
.
AlterModelTable
(
name
=
'emaillogs'
,
table
=
'email_logs'
,
),
]
app/entities/migrations/0007_auto_20190911_1102.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-11 11:02
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0006_emaillogs_is_sent'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'changerequestformheader'
,
name
=
'requested_to_template_id'
,
field
=
models
.
CharField
(
max_length
=
255
),
),
]
app/entities/migrations/0008_auto_20190911_1715.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-11 17:15
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0007_auto_20190911_1102'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'changerequesthistory'
,
name
=
'form_code'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
null
=
True
),
),
]
app/entities/migrations/0008_passwordreset.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-11 11:53
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0007_auto_20190911_1026'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'PasswordReset'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'email'
,
models
.
EmailField
(
max_length
=
255
)),
(
'token'
,
models
.
CharField
(
max_length
=
255
)),
(
'created_at'
,
models
.
DateTimeField
()),
(
'timeout_at'
,
models
.
DateTimeField
()),
(
'is_active'
,
models
.
BooleanField
(
default
=
True
)),
(
'code'
,
models
.
CharField
(
max_length
=
50
)),
],
options
=
{
'db_table'
:
'password_resets'
,
},
),
]
app/entities/migrations/0009_auto_20190911_1845.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-11 18:45
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0008_auto_20190911_1715'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'changerequestformapprovers'
,
old_name
=
'deleted_at'
,
new_name
=
'archived_at'
,
),
migrations
.
RenameField
(
model_name
=
'changerequestformattachments'
,
old_name
=
'deleted_at'
,
new_name
=
'archived_at'
,
),
migrations
.
RenameField
(
model_name
=
'changerequestformdetails'
,
old_name
=
'deleted_at'
,
new_name
=
'archived_at'
,
),
migrations
.
RenameField
(
model_name
=
'changerequestformheader'
,
old_name
=
'deleted_at'
,
new_name
=
'archived_at'
,
),
migrations
.
RenameField
(
model_name
=
'changerequestformstakeholders'
,
old_name
=
'deleted_at'
,
new_name
=
'archived_at'
,
),
migrations
.
RenameField
(
model_name
=
'changerequesttemplateapprovers'
,
old_name
=
'deleted_at'
,
new_name
=
'archived_at'
,
),
migrations
.
RenameField
(
model_name
=
'changerequesttemplateattachments'
,
old_name
=
'deleted_at'
,
new_name
=
'archived_at'
,
),
migrations
.
RenameField
(
model_name
=
'changerequesttemplatedetails'
,
old_name
=
'deleted_at'
,
new_name
=
'archived_at'
,
),
migrations
.
RenameField
(
model_name
=
'changerequesttemplateheader'
,
old_name
=
'deleted_at'
,
new_name
=
'archived_at'
,
),
migrations
.
RenameField
(
model_name
=
'changerequesttemplatestakeholders'
,
old_name
=
'deleted_at'
,
new_name
=
'archived_at'
,
),
]
app/entities/migrations/0010_auto_20190913_1143.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-13 11:43
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0009_auto_20190911_1845'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'changerequestformapprovers'
,
name
=
'archived_at'
,
),
migrations
.
RemoveField
(
model_name
=
'changerequestformattachments'
,
name
=
'archived_at'
,
),
migrations
.
RemoveField
(
model_name
=
'changerequestformdetails'
,
name
=
'archived_at'
,
),
migrations
.
RemoveField
(
model_name
=
'changerequestformheader'
,
name
=
'archived_at'
,
),
migrations
.
RemoveField
(
model_name
=
'changerequestformstakeholders'
,
name
=
'archived_at'
,
),
]
app/entities/migrations/0011_merge_20190913_1545.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-13 15:45
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0008_passwordreset'
),
(
'entities'
,
'0010_auto_20190913_1143'
),
]
operations
=
[
]
app/entities/migrations/0012_auto_20190913_1704.py
deleted
100644 → 0
View file @
f10766e7
# Generated by Django 2.2 on 2019-09-13 17:04
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0011_merge_20190913_1545'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'changerequesttemplateheader'
,
name
=
'requested_to_target_date'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
10
,
null
=
True
),
),
]
app/entities/models.py
View file @
e15e62b2
...
...
@@ -43,6 +43,7 @@ class Application(AuditClass):
class
Module
(
AuditClass
):
application
=
models
.
ForeignKey
(
Application
,
to_field
=
'code'
,
related_name
=
'modules'
,
on_delete
=
models
.
PROTECT
)
...
...
@@ -108,6 +109,7 @@ class Department(AuditClass):
# )
company
=
models
.
ForeignKey
(
Company
,
to_field
=
'code'
,
related_name
=
'companies'
,
on_delete
=
models
.
PROTECT
)
...
...
@@ -204,9 +206,12 @@ class User(AbstractUser):
Application
)
department
=
models
.
ForeignKey
(
Department
,
related_name
=
'department_users'
,
Department
,
to_field
=
'code'
,
related_name
=
'department_users'
,
on_delete
=
models
.
PROTECT
,
default
=
1
blank
=
True
,
null
=
True
)
# role = models.ForeignKey(
# Role,
...
...
@@ -214,7 +219,15 @@ class User(AbstractUser):
# on_delete=models.PROTECT,
# default=1
# )
default_app
=
models
.
CharField
(
blank
=
True
,
null
=
True
,
max_length
=
255
)
# default_app = models.CharField(blank=True, null=True, max_length=255)
default_app
=
models
.
ForeignKey
(
Application
,
to_field
=
'code'
,
related_name
=
'default_app'
,
on_delete
=
models
.
PROTECT
,
blank
=
True
,
null
=
True
)
user_type
=
models
.
CharField
(
choices
=
[(
tag
.
value
,
tag
.
value
)
for
tag
in
enums
.
UserTypeEnum
],
default
=
enums
.
UserTypeEnum
.
USER
.
value
,
...
...
@@ -233,7 +246,9 @@ class User(AbstractUser):
null
=
True
)
doa
=
models
.
ForeignKey
(
'User'
,
related_name
=
'doa_users'
,
'User'
,
to_field
=
'code'
,
related_name
=
'doa_users'
,
on_delete
=
models
.
PROTECT
,
blank
=
True
,
null
=
True
...
...
@@ -258,6 +273,7 @@ class User(AbstractUser):
class
UserImage
(
AuditClass
):
user
=
models
.
ForeignKey
(
User
,
to_field
=
'code'
,
related_name
=
'user_images'
,
on_delete
=
models
.
PROTECT
)
...
...
@@ -300,7 +316,7 @@ class AuthToken(models.Model):
passcode
=
models
.
CharField
(
max_length
=
255
)
timeout
=
models
.
IntegerField
()
is_active
=
models
.
BooleanField
(
default
=
False
)
user
=
models
.
ForeignKey
(
User
,
user
=
models
.
ForeignKey
(
User
,
to_field
=
'code'
,
related_name
=
'auth_access_token'
,
on_delete
=
models
.
PROTECT
)
...
...
@@ -964,3 +980,4 @@ class PasswordReset(models.Model):
class
Meta
:
db_table
=
'password_resets'
app/helper/decorators.py
View file @
e15e62b2
...
...
@@ -84,7 +84,7 @@ class rms:
elif
rms
.
user_type
(
self
)
==
rms
.
enums_company
:
user_company
=
rms
.
user
(
self
)
.
department
.
company
request_department
=
Department
.
objects
.
filter
(
Q
(
id
=
request
.
data
[
'department'
])
&
Q
(
code
=
request
.
data
[
'department'
])
&
Q
(
company
=
user_company
)
)
if
not
request_department
:
...
...
requirements/RMSv2.postman_collection_091619
View file @
e15e62b2
This diff is collapsed.
Click to expand it.
requirements/rms_17092019.sql
0 → 100644
View file @
e15e62b2
This diff is collapsed.
Click to expand it.
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