(20241218) Can now add tags to SMS messages while sending them, and small 'limit' bug fixed in listing mails where a huge no. of tokens are being sent.

This commit is contained in:
2024-12-18 11:10:18 +05:30
parent c340ebcba5
commit b42da0dacb
8 changed files with 32 additions and 13 deletions
+10 -5
View File
@@ -187,6 +187,7 @@ class SMSController:
http_client: httpx.AsyncClient,
auth_token: CoreAuthTokenModel,
messages: List[NimbusSMSIndiaMessage],
tags: List[Any]
) -> SMSSendManyResults:
# Start with a blank variable:
@@ -232,7 +233,7 @@ class SMSController:
message = client_response.model_dump(),
snippet = message.text,
aiSnippet = None,
tags = ["sms", "nimbusSmsIndia"]
tags = list(set(tags + ["SMS", "Nimbus SMS", "India"]))
))
# Done here:
@@ -243,6 +244,7 @@ class SMSController:
http_client: httpx.AsyncClient,
auth_token: CoreAuthTokenModel,
messages: List[SavvyBulkSMSKenyaMessage],
tags: List[Any]
) -> SMSSendManyResults:
# Start with a blank variable:
@@ -286,7 +288,7 @@ class SMSController:
message = client_response.model_dump(),
snippet = message.text,
aiSnippet = None,
tags = ["sms", "savvyBulkSmsKenya"]
tags = list(set(tags + ["SMS", "Savvy Bulk SMS", "Kenya"]))
))
# Done here:
@@ -297,7 +299,8 @@ class SMSController:
mongo_conn: AsyncMongo,
http_client: httpx.AsyncClient,
auth_token: CoreAuthTokenModel,
messages: List[NimbusSMSIndiaMessage | SavvyBulkSMSKenyaMessage]
messages: List[NimbusSMSIndiaMessage | SavvyBulkSMSKenyaMessage],
tags: List[Any]
) -> SMSSendManyResults:
# Start by assuming failure:
@@ -309,13 +312,15 @@ class SMSController:
send_results = await self.__send_from_nimbus_sms_india(
http_client = http_client,
auth_token = auth_token,
messages = messages
messages = messages,
tags = tags
)
case "savvyBulkSmsKenya":
send_results = await self.__send_from_savvy_bulk_sms_kenya(
http_client = http_client,
auth_token = auth_token,
messages = messages
messages = messages,
tags = tags
)
case _:
send_results.message = f"invalid client {auth_token.client}"