-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added RTT tag and notification for RTT attachments #5148
Changes from all commits
ee1d60b
48f2033
53d6e25
ff51bf0
70756e4
4dbd1eb
ea139b6
b89bae4
bb09559
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"""Add RTT tag | ||
|
||
Revision ID: e698b39da6bd | ||
Revises: 6646acda32fe | ||
Create Date: 2024-04-15 08:17:20.554269 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'e698b39da6bd' | ||
down_revision = '6646acda32fe' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
def upgrade(): | ||
op.execute('INSERT INTO public."NotificationTypes"(name, description, isactive,notificationtypelabel ) VALUES (\'Attachment Upload Event\', \'Attachment Upload Event\', true, \'attachmentuploadevent\');') | ||
|
||
def downgrade(): | ||
op.execute('DELETE FROM public."NotificationTypes" WHERE name = \'Attachment Upload Event\';') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
from request_api.services.commons.duecalculator import duecalculator | ||
from request_api.services.notificationservice import notificationservice | ||
from request_api.services.commentservice import commentservice | ||
from request_api.models.FOIMinistryRequests import FOIMinistryRequest | ||
from request_api.models.FOIRequestComments import FOIRequestComment | ||
from request_api.models.NotificationTypes import NotificationType | ||
from request_api.exceptions import BusinessException | ||
from request_api.models.default_method_result import DefaultMethodResult | ||
from flask import current_app | ||
|
||
class attachmentevent(): | ||
""" FOI Attachment Event management service | ||
|
||
""" | ||
def createattachmentevent(self, ministryrequestid, message, userid, event): | ||
try: | ||
notificationtype = NotificationType().getnotificationtypeid(self.__notificationtype()) | ||
self.__createnotification(message, ministryrequestid, notificationtype, userid) | ||
return DefaultMethodResult(True, message, '') | ||
except BusinessException as exception: | ||
current_app.logger.error("%s,%s" % ('Attachment upload notification error', exception.message)) | ||
return DefaultMethodResult(False,'Attachemnt notifications failed') | ||
|
||
def __createnotification(self, message, requestid, notificationtype, userid): | ||
if message is not None: | ||
return notificationservice().createnotification({"message" : message}, requestid, "ministryrequest", notificationtype, userid) | ||
|
||
def notificationmessage(self, type): | ||
return f"{type} Attachment Uploaded" | ||
|
||
def __notificationtype(self): | ||
return "Attachment Upload Event" | ||
|
||
def __defaultuserid(self): | ||
return "System" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove unnecessary codes or functions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, make sure to include scanning team members as discussed. The changes should be done in services\notifications\notificationuser.py |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
from request_api.services.events.oipcduedate import oipcduedateevent | ||
from request_api.services.events.extension import extensionevent | ||
from request_api.services.events.cfrfeeform import cfrfeeformevent | ||
from request_api.services.events.attachment import attachmentevent | ||
from request_api.services.events.payment import paymentevent | ||
from request_api.services.events.email import emailevent | ||
from request_api.services.events.section5pending import section5pendingevent | ||
|
@@ -32,6 +33,7 @@ async def postevent(self, requestid, requesttype, userid, username, isministryus | |
self.posteventsync(requestid, requesttype, userid, username, isministryuser,assigneename) | ||
|
||
def posteventsync(self, requestid, requesttype, userid, username, isministryuser,assigneename=''): | ||
print("\n ..... postevent is triggered ...... \n") | ||
try: | ||
stateeventresponse = stateevent().createstatetransitionevent(requestid, requesttype, userid, username) | ||
divisioneventresponse = divisionevent().createdivisionevent(requestid, requesttype, userid) | ||
|
@@ -58,6 +60,14 @@ def posteventforaxisextension(self, ministryrequestid, extensionids, userid, use | |
current_app.logger.error("FOI Notification failed for event for extension= %s" % (extensionid)) | ||
except BusinessException as exception: | ||
self.__logbusinessexception(exception) | ||
|
||
def attachmentevent(self, ministryrequestid, document, userid, event, message): | ||
try: | ||
attachmenteventresponse = attachmentevent().createattachmentevent(ministryrequestid, message , userid, event) | ||
if attachmenteventresponse.success == False: | ||
current_app.logger.error("FOI Notification failed for event for attachment= %s" % (document['category'])) | ||
except BusinessException as exception: | ||
self.__logbusinessexception(exception) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update it as async event. |
||
|
||
def postreminderevent(self): | ||
try: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep the RRT related changes to events/attatment.py
Also, call the attachmentevent from the resource level(POST)