Commit 286ec03f authored by John Red Medrano's avatar John Red Medrano

Merge pull request #489 in RMS/api-main-service from red-develop to RMSv2

* commit 'fe2e0b3b':
  pull latest changes on RMSv2
  added new endpoint for ETL users
parents bd79850f fe2e0b3b
from rest_framework import serializers
from app.entities.models import MasterAttachment
class BatchUploadSerializer(serializers.ModelSerializer):
class Meta:
model = MasterAttachment
fields = '__all__'
read_only_fields = (
'created', 'createdby', 'modified', 'modifiedby', 'code',
)
from rest_framework import viewsets, status
from rest_framework.response import Response
from app.entities.models import MasterAttachment
from app.applicationlayer.utils import (
CustomPagination, status_message_response, log_save
)
# from django_filters.rest_framework import DjangoFilterBackend
from app.applicationlayer.download.batch_upload.serializer import (
BatchUploadSerializer
)
import os
import configparser
config = configparser.ConfigParser()
config_file = os.path.join('./', 'env.ini')
config.read(config_file)
class BatchUploadFormatViewSet(viewsets.ModelViewSet):
queryset = MasterAttachment.objects.filter(
url__contains=config['SETTINGS']['BATCH_UPLOAD_FORMAT_FILENAME']
)
serializer_class = BatchUploadSerializer
from rest_framework import serializers from rest_framework import serializers
from app.entities.models import ExtractTransformLoad, UserHistory from app.entities.models import (
ExtractTransformLoad, UserHistory, MasterAttachment
)
class ExtractTransformLoadSerializer(serializers.ModelSerializer): class ExtractTransformLoadSerializer(serializers.ModelSerializer):
...@@ -18,3 +20,24 @@ class UserHistorySerializer(serializers.ModelSerializer): ...@@ -18,3 +20,24 @@ class UserHistorySerializer(serializers.ModelSerializer):
read_only_fields = ( read_only_fields = (
'created', 'createdby', 'modified', 'code' 'created', 'createdby', 'modified', 'code'
) )
class BatchUploadSerializer(serializers.ModelSerializer):
class Meta:
model = MasterAttachment
fields = '__all__'
read_only_fields = (
'created', 'createdby', 'modified', 'modifiedby', 'code',
)
class BatchUploadSerializer(serializers.ModelSerializer):
class Meta:
model = MasterAttachment
fields = '__all__'
read_only_fields = (
'created', 'createdby', 'modified', 'modifiedby', 'code',
)
...@@ -15,7 +15,6 @@ from app.applicationlayer.management.delegation.views import DelegationViewSet ...@@ -15,7 +15,6 @@ from app.applicationlayer.management.delegation.views import DelegationViewSet
from app.applicationlayer.download.accounts.views import UserDownloadRequest from app.applicationlayer.download.accounts.views import UserDownloadRequest
from app.applicationlayer.download.department.views import DepartmentDownloadRequest from app.applicationlayer.download.department.views import DepartmentDownloadRequest
from app.applicationlayer.download.company.views import CompanyDownloadRequest from app.applicationlayer.download.company.views import CompanyDownloadRequest
from app.applicationlayer.download.batch_upload.views import BatchUploadFormatViewSet
router = routers.DefaultRouter() router = routers.DefaultRouter()
...@@ -29,7 +28,6 @@ router.register(r'notifications', NotificationsViewset) ...@@ -29,7 +28,6 @@ router.register(r'notifications', NotificationsViewset)
router.register(r'user-download', UserDownloadRequest) router.register(r'user-download', UserDownloadRequest)
router.register(r'department-download', DepartmentDownloadRequest) router.register(r'department-download', DepartmentDownloadRequest)
router.register(r'company-download', CompanyDownloadRequest) router.register(r'company-download', CompanyDownloadRequest)
router.register(r'batch-upload-format', BatchUploadFormatViewSet)
router.register(r'delegations', DelegationViewSet) router.register(r'delegations', DelegationViewSet)
router.register(r'extract-transform-load', BatchUploadViewSet) router.register(r'extract-transform-load', BatchUploadViewSet)
......
...@@ -9,7 +9,14 @@ from . import enums ...@@ -9,7 +9,14 @@ from . import enums
from django.utils.text import slugify from django.utils.text import slugify
from datetime import timedelta from datetime import timedelta
import os import os
<<<<<<< HEAD
<<<<<<< HEAD
=======
from django.conf import settings from django.conf import settings
>>>>>>> bd79850f02d697447131ae812adc4b42cf78960a
=======
from django.conf import settings
>>>>>>> bd79850f02d697447131ae812adc4b42cf78960a
# ********************* AUTH TABLES ********************* # ********************* AUTH TABLES *********************
...@@ -524,6 +531,14 @@ class MasterAttachment(models.Model): ...@@ -524,6 +531,14 @@ class MasterAttachment(models.Model):
blank=True, blank=True,
null=True) null=True)
attch_ref = models.TextField() attch_ref = models.TextField()
def delete(self,*args,**kwargs):
print(self.url.name)
if os.path.isfile(self.url.path):
os.remove(self.url.path)
super(MasterAttachment, self).delete(*args,**kwargs)
class Meta: class Meta:
db_table = 'master_attachments' db_table = 'master_attachments'
......
<!DOCTYPE html> <<<<<<< HEAD
<html> <!DOCTYPE html>
<head> <html>
<title>RMS: Change Request Cancelled</title> <head>
</head> <title>RMS: Change Request Cancelled</title>
<body style="font-family: arial;"> </head>
<body style="font-family: arial;">
<h3>Resource Management System &#40;RMS&#41;</h3>
<h3 style="color:#888888;">Change Request Cancelled</h3><br> <h3>Resource Management System &#40;RMS&#41;</h3>
<h3 style="color:#888888;">Change Request Cancelled</h3><br>
<p>Dear {name},</p><br>
<p>Your change request has been cancelled. Please see the details of the change request below.</p><br> <p>Dear {name},</p><br>
<p>Your change request has been cancelled. Please see the details of the change request below.</p><br>
<b>Cancelled By</b><br>{action_by}<br><br>
<b>Routing Level</b><br>{routing_level}<br><br> <b>Cancelled By</b><br>{action_by}<br><br>
<b>Status</b><br>{status}<br><br><br> <b>Routing Level</b><br>{routing_level}<br><br>
<b>Status</b><br>{status}<br><br><br>
<b>CR Number</b><br>{cr_number}<br><br>
<b>CR Name</b><br>{cr_name}<br><br> <b>CR Number</b><br>{cr_number}<br><br>
<b>Company Requested To</b><br>{company_requestedto}<br><br> <b>CR Name</b><br>{cr_name}<br><br>
<b>Department Requested To</b><br>{department_requestedto}<br><br> <b>Company Requested To</b><br>{company_requestedto}<br><br>
<b>Priority Level</b><br>{priority_level}<br><br> <b>Department Requested To</b><br>{department_requestedto}<br><br>
<b>Priority Level</b><br>{priority_level}<br><br>
<p>Please click <u><a href="{url}" style="text-decoration:underline;color:#007bff;" target="_blank">here</a></u> to access your change request.</p><br>
<p>Please click <u><a href="{url}" style="text-decoration:underline;color:#007bff;" target="_blank">here</a></u> to access your change request.</p><br>
<p>Sincerely,</p>
<p>RMS Team</p><br><br> <p>Sincerely,</p>
<p>RMS Team</p><br><br>
<p>Powered by</p>
<img src="https://s3-ap-southeast-1.amazonaws.com/oneberry/img/logo_oneberry.png" class="img-responsive" style="width:150px;height:auto;" /> <p>Powered by</p>
<img src="https://s3-ap-southeast-1.amazonaws.com/oneberry/img/logo_oneberry.png" class="img-responsive" style="width:150px;height:auto;" />
</body>
</body>
=======
<!DOCTYPE html>
<html>
<head>
<title>RMS: Change Request Cancelled</title>
</head>
<body style="font-family: arial;">
<h3>Resource Management System &#40;RMS&#41;</h3>
<h3 style="color:#888888;">Change Request Cancelled</h3><br>
<p>Dear {name},</p><br>
<p>Your change request has been cancelled. Please see the details of the change request below.</p><br>
<b>Cancelled By</b><br>{action_by}<br><br>
<b>Routing Level</b><br>{routing_level}<br><br>
<b>Status</b><br>{status}<br><br><br>
<b>CR Number</b><br>{cr_number}<br><br>
<b>CR Name</b><br>{cr_name}<br><br>
<b>Company Requested To</b><br>{company_requestedto}<br><br>
<b>Department Requested To</b><br>{department_requestedto}<br><br>
<b>Priority Level</b><br>{priority_level}<br><br>
<p>Please click <u><a href="{url}" style="text-decoration:underline;color:#007bff;" target="_blank">here</a></u> to access your change request.</p><br>
<p>Sincerely,</p>
<p>RMS Team</p><br><br>
<p>Powered by</p>
<img src="https://s3-ap-southeast-1.amazonaws.com/oneberry/img/logo_oneberry.png" class="img-responsive" style="width:150px;height:auto;" />
</body>
>>>>>>> bd79850f02d697447131ae812adc4b42cf78960a
</html> </html>
\ No newline at end of file
<!DOCTYPE html> <<<<<<< HEAD
<html> <!DOCTYPE html>
<head> <html>
<title>RMS: Change Request Rejected</title> <head>
</head> <title>RMS: Change Request Rejected</title>
<body style="font-family: arial;"> </head>
<body style="font-family: arial;">
<h3>Resource Management System &#40;RMS&#41;</h3>
<h3 style="color:#888888;">Change Request Revision</h3><br> <h3>Resource Management System &#40;RMS&#41;</h3>
<h3 style="color:#888888;">Change Request Revision</h3><br>
<p>Dear {name},</p><br>
<p>A change request has been submitted for your acknowledgement to revise. Please see the details of the change request below.</p><br> <p>Dear {name},</p><br>
<p>A change request has been submitted for your acknowledgement to revise. Please see the details of the change request below.</p><br>
<b>Rejected By</b><br>{action_by}<br><br>
<b>Routing Level</b><br>{routing_level}<br><br> <b>Rejected By</b><br>{action_by}<br><br>
<b>Status</b><br>{status}<br><br><br> <b>Routing Level</b><br>{routing_level}<br><br>
<b>Status</b><br>{status}<br><br><br>
<b>CR Number</b><br>{cr_number}<br><br>
<b>CR Name</b><br>{cr_name}<br><br> <b>CR Number</b><br>{cr_number}<br><br>
<b>Company Requested To</b><br>{company_requestedto}<br><br> <b>CR Name</b><br>{cr_name}<br><br>
<b>Department Requested To</b><br>{department_requestedto}<br><br> <b>Company Requested To</b><br>{company_requestedto}<br><br>
<b>Priority Level</b><br>{priority_level}<br><br> <b>Department Requested To</b><br>{department_requestedto}<br><br>
<b>Remarks</b><br>{remarks}<br><br> <b>Priority Level</b><br>{priority_level}<br><br>
<b>Remarks</b><br>{remarks}<br><br>
<p>Please click <u><a href="{url}" style="text-decoration:underline;color:#007bff;" target="_blank">here</a></u> to access your change request.</p><br>
<p>Please click <u><a href="{url}" style="text-decoration:underline;color:#007bff;" target="_blank">here</a></u> to access your change request.</p><br>
<p>Sincerely,</p>
<p>RMS Team</p><br><br> <p>Sincerely,</p>
<p>RMS Team</p><br><br>
<p>Powered by</p>
<img src="https://s3-ap-southeast-1.amazonaws.com/oneberry/img/logo_oneberry.png" class="img-responsive" style="width:150px;height:auto;" /> <p>Powered by</p>
<img src="https://s3-ap-southeast-1.amazonaws.com/oneberry/img/logo_oneberry.png" class="img-responsive" style="width:150px;height:auto;" />
</body>
</body>
=======
<!DOCTYPE html>
<html>
<head>
<title>RMS: Change Request Rejected</title>
</head>
<body style="font-family: arial;">
<h3>Resource Management System &#40;RMS&#41;</h3>
<h3 style="color:#888888;">Change Request Revision</h3><br>
<p>Dear {name},</p><br>
<p>A change request has been submitted for your acknowledgement to revise. Please see the details of the change request below.</p><br>
<b>Rejected By</b><br>{action_by}<br><br>
<b>Routing Level</b><br>{routing_level}<br><br>
<b>Status</b><br>{status}<br><br><br>
<b>CR Number</b><br>{cr_number}<br><br>
<b>CR Name</b><br>{cr_name}<br><br>
<b>Company Requested To</b><br>{company_requestedto}<br><br>
<b>Department Requested To</b><br>{department_requestedto}<br><br>
<b>Priority Level</b><br>{priority_level}<br><br>
<b>Remarks</b><br>{remarks}<br><br>
<p>Please click <u><a href="{url}" style="text-decoration:underline;color:#007bff;" target="_blank">here</a></u> to access your change request.</p><br>
<p>Sincerely,</p>
<p>RMS Team</p><br><br>
<p>Powered by</p>
<img src="https://s3-ap-southeast-1.amazonaws.com/oneberry/img/logo_oneberry.png" class="img-responsive" style="width:150px;height:auto;" />
</body>
>>>>>>> bd79850f02d697447131ae812adc4b42cf78960a
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment