Commit bf949ed1 by Oleksandr Barabash

notification.destination changed to notification.conversation_id

parent d61f7754
......@@ -166,7 +166,7 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
""" async routine """
try:
reference = await self.cosmos_client.get_conversation(
notification.destination
notification.conversation_id
)
except ItemNotFound:
future.set_exception(ConversationNotFound("not found"))
......@@ -178,19 +178,13 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
async def callback(turn_context: TurnContext) -> None:
""" Turn Context callback. Kinda awful syntax, I know """
try:
card = CardHelper.create_notification_card(
await self.cosmos_client.create_notification(
notification
)
)
card = CardHelper.create_notification_card(notification)
attachments = [CardFactory.adaptive_card(card)]
message = Activity(type=ActivityTypes.message,
attachments=attachments)
response = await turn_context.send_activity(message)
notification.message_id = response.id
await self.cosmos_client.update_notification(
notification
)
await self.cosmos_client.create_notification(notification)
print(f"notification response: {response}")
future.set_result(notification.id)
except Exception as exception:
......
......@@ -17,7 +17,7 @@ class NotificationUrl(CamelCaseMixin):
class Notification(CamelCaseMixin):
""" Notification Dataclass """
message_id: Optional[str]
destination: str
conversation_id: str
subject: Optional[str] = field(default=None)
message: Optional[str] = field(default=None)
title: Optional[str] = field(default=None)
......@@ -28,7 +28,7 @@ class Notification(CamelCaseMixin):
def to_db(self) -> "NotificationCosmos":
""" Create NotificationCosmos """
return NotificationCosmos(message_id=self.message_id,
destination=self.destination,
conversation_id=self.conversation_id,
subject=self.subject,
message=self.message,
title=self.title,
......
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