-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save and retrieve the customized subject and body to and from the dat…
…abase
- Loading branch information
1 parent
1b0385d
commit adfb256
Showing
4 changed files
with
134 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 39 additions & 27 deletions
66
...nn.Notifications.Persistence/Migration/FunctionsAndProcedures/insertemailnotification.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,47 @@ | ||
CREATE OR REPLACE PROCEDURE notifications.insertemailnotification( | ||
_orderid uuid, | ||
_alternateid uuid, | ||
_recipientorgno TEXT, | ||
_recipientnin TEXT, | ||
_toaddress TEXT, | ||
_result text, | ||
_resulttime timestamptz, | ||
_expirytime timestamptz) | ||
_orderid uuid, | ||
_alternateid uuid, | ||
_recipientorgno TEXT, | ||
_recipientnin TEXT, | ||
_toaddress TEXT, | ||
_customizedbody TEXT, | ||
_customizedsubject TEXT, | ||
_result TEXT, | ||
_resulttime timestamptz, | ||
_expirytime timestamptz | ||
) | ||
LANGUAGE 'plpgsql' | ||
AS $BODY$ | ||
DECLARE | ||
__orderid BIGINT := (SELECT _id from notifications.orders | ||
where alternateid = _orderid); | ||
__orderid BIGINT; | ||
BEGIN | ||
SELECT _id INTO __orderid | ||
FROM notifications.orders | ||
WHERE alternateid = _orderid; | ||
|
||
INSERT INTO notifications.emailnotifications( | ||
_orderid, | ||
alternateid, | ||
recipientorgno, | ||
recipientnin, | ||
toaddress, result, | ||
resulttime, | ||
expirytime) | ||
VALUES ( | ||
__orderid, | ||
_alternateid, | ||
_recipientorgno, | ||
_recipientnin, | ||
_toaddress, | ||
_result::emailnotificationresulttype, | ||
_resulttime, | ||
_expirytime); | ||
INSERT INTO notifications.emailnotifications( | ||
_orderid, | ||
alternateid, | ||
recipientorgno, | ||
recipientnin, | ||
toaddress, | ||
customizedbody, | ||
customizedsubject, | ||
result, | ||
resulttime, | ||
expirytime | ||
) | ||
VALUES ( | ||
__orderid, | ||
_alternateid, | ||
_recipientorgno, | ||
_recipientnin, | ||
_toaddress, | ||
_customizedbody, | ||
_customizedsubject, | ||
_result::emailnotificationresulttype, | ||
_resulttime, | ||
_expirytime | ||
); | ||
END; | ||
$BODY$; |
69 changes: 38 additions & 31 deletions
69
...tinn.Notifications.Persistence/Migration/FunctionsAndProcedures/insertsmsnotification.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,47 @@ | ||
CREATE OR REPLACE PROCEDURE notifications.insertsmsnotification( | ||
_orderid uuid, | ||
_alternateid uuid, | ||
_recipientorgno TEXT, | ||
_recipientnin TEXT, | ||
_mobilenumber TEXT, | ||
_result text, | ||
_smscount integer, | ||
_resulttime timestamptz, | ||
_expirytime timestamptz | ||
_orderid uuid, | ||
_alternateid uuid, | ||
_recipientorgno TEXT, | ||
_recipientnin TEXT, | ||
_mobilenumber TEXT, | ||
_customizedbody TEXT, | ||
_result TEXT, | ||
_smscount integer, | ||
_resulttime timestamptz, | ||
_expirytime timestamptz | ||
) | ||
LANGUAGE 'plpgsql' | ||
AS $BODY$ | ||
DECLARE | ||
__orderid BIGINT := (SELECT _id from notifications.orders | ||
where alternateid = _orderid); | ||
__orderid BIGINT; | ||
BEGIN | ||
SELECT _id INTO __orderid | ||
FROM notifications.orders | ||
WHERE alternateid = _orderid; | ||
|
||
INSERT INTO notifications.smsnotifications( | ||
_orderid, | ||
alternateid, | ||
recipientorgno, | ||
recipientnin, | ||
mobilenumber, | ||
result, | ||
smscount, | ||
resulttime, | ||
expirytime) | ||
VALUES ( | ||
__orderid, | ||
_alternateid, | ||
_recipientorgno, | ||
_recipientnin, | ||
_mobilenumber, | ||
_result::smsnotificationresulttype, | ||
_smscount, | ||
_resulttime, | ||
_expirytime); | ||
INSERT INTO notifications.smsnotifications( | ||
_orderid, | ||
alternateid, | ||
recipientorgno, | ||
recipientnin, | ||
mobilenumber, | ||
customizedbody, | ||
result, | ||
smscount, | ||
resulttime, | ||
expirytime | ||
) | ||
VALUES ( | ||
__orderid, | ||
_alternateid, | ||
_recipientorgno, | ||
_recipientnin, | ||
_mobilenumber, | ||
_customizedbody, | ||
_result::smsnotificationresulttype, | ||
_smscount, | ||
_resulttime, | ||
_expirytime | ||
); | ||
END; | ||
$BODY$; |