leadguru-jobs 0.627.0__tar.gz → 0.629.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/PKG-INFO +1 -1
  2. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/leadguru_jobs.egg-info/PKG-INFO +1 -1
  3. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/inbox_leads.py +1 -4
  4. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_data/model.py +1 -1
  5. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_data/models/message_request.py +5 -1
  6. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_data/mongo_repository.py +6 -1
  7. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/MANIFEST.in +0 -0
  8. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/README.md +0 -0
  9. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/leadguru_jobs.egg-info/SOURCES.txt +0 -0
  10. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/leadguru_jobs.egg-info/dependency_links.txt +0 -0
  11. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/leadguru_jobs.egg-info/not-zip-safe +0 -0
  12. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/leadguru_jobs.egg-info/requires.txt +0 -0
  13. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/leadguru_jobs.egg-info/top_level.txt +0 -0
  14. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/__init__.py +0 -0
  15. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/assets/images/arrow.png +0 -0
  16. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/assets/images/firework.png +0 -0
  17. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/assets/images/lock.png +0 -0
  18. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/assets/images/logo.png +0 -0
  19. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/assets/images/mail.png +0 -0
  20. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/basejobs.py +0 -0
  21. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/env.py +0 -0
  22. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/__init__.py +0 -0
  23. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/analytics.py +0 -0
  24. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/bot_stats_update.py +0 -0
  25. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/chat_history.py +0 -0
  26. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/connect_sources.py +0 -0
  27. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/load_slack_people.py +0 -0
  28. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/mass_message.py +0 -0
  29. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/send_code.py +0 -0
  30. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/send_slack_message.py +0 -0
  31. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/update_slack_profile.py +0 -0
  32. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/jobs/workspace_connect.py +0 -0
  33. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/__init__.py +0 -0
  34. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/discord_client/__init__.py +0 -0
  35. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/discord_client/discord_client.py +0 -0
  36. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/discord_client/methods.py +0 -0
  37. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/enums/__init__.py +0 -0
  38. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/enums/slack_errors.py +0 -0
  39. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/helpers.py +0 -0
  40. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/lgt_logging.py +0 -0
  41. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/pubsub/__init__.py +0 -0
  42. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/pubsub/messages.py +0 -0
  43. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/pubsub/pubsubfactory.py +0 -0
  44. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/slack_client/__init__.py +0 -0
  45. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/slack_client/methods.py +0 -0
  46. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/slack_client/slack_client.py +0 -0
  47. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_common/slack_client/web_client.py +0 -0
  48. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_data/__init__.py +0 -0
  49. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_data/analytics.py +0 -0
  50. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_data/engine.py +0 -0
  51. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_data/enums.py +0 -0
  52. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_data/helpers.py +0 -0
  53. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/lgt_data/models/__init__.py +0 -0
  54. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/main.py +0 -0
  55. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/runner.py +0 -0
  56. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/services/__init__.py +0 -0
  57. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/services/web_client.py +0 -0
  58. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/simple_job.py +0 -0
  59. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/smtp.py +0 -0
  60. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/lgt_jobs/templates/new_message.html +0 -0
  61. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/setup.cfg +0 -0
  62. {leadguru_jobs-0.627.0 → leadguru_jobs-0.629.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: leadguru_jobs
3
- Version: 0.627.0
3
+ Version: 0.629.0
4
4
  Summary: LGT jobs builds
5
5
  Author-email: developer@leadguru.co
6
6
  Classifier: Development Status :: 5 - Production/Stable
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: leadguru_jobs
3
- Version: 0.627.0
3
+ Version: 0.629.0
4
4
  Summary: LGT jobs builds
5
5
  Author-email: developer@leadguru.co
6
6
  Classifier: Development Status :: 5 - Production/Stable
@@ -7,7 +7,6 @@ from lgt_jobs.lgt_data.mongo_repository import UserMongoRepository, DedicatedBot
7
7
  SlackContactUserRepository, UserContactsRepository, MessageRequestsRepository
8
8
  from pydantic import BaseModel
9
9
  from lgt_jobs.basejobs import BaseBackgroundJob, BaseBackgroundJobData
10
- from lgt_jobs.services.web_client import V3ServerClient
11
10
  from requests import exceptions
12
11
 
13
12
  """
@@ -20,14 +19,12 @@ class InboxLeadsJobData(BaseBackgroundJobData, BaseModel):
20
19
 
21
20
 
22
21
  class InboxLeadsJob(BaseBackgroundJob, ABC):
23
- v3_client: V3ServerClient
24
22
 
25
23
  @property
26
24
  def job_data_type(self) -> type:
27
25
  return InboxLeadsJobData
28
26
 
29
27
  def exec(self, _: InboxLeadsJobData):
30
- self.v3_client = V3ServerClient()
31
28
  users = UserMongoRepository().get_users()
32
29
  for user in users:
33
30
  log.info(f'[InboxLeadsJob]: Loading chat for the: {user.email}')
@@ -83,7 +80,7 @@ class InboxLeadsJob(BaseBackgroundJob, ABC):
83
80
 
84
81
  log.info(f"[InboxLeadsJob]: New message request from {sender_id} for user: {user.email}")
85
82
  message_request = MessageRequest.from_slack_response(dedicated_bot, messages[0], sender_id)
86
- MessageRequestsRepository().insert(message_request)
83
+ MessageRequestsRepository().upsert(user.id, sender_id, message_request)
87
84
 
88
85
  @staticmethod
89
86
  def create_people(slack_profile: dict, dedicated_bot: DedicatedBotModel):
@@ -705,7 +705,7 @@ class ChatMessage:
705
705
  return model
706
706
 
707
707
  @classmethod
708
- def from_slack_response(cls, bot: DedicatedBotModel, message_data: dict, sender_id: str) -> ChatMessage:
708
+ def from_slack_response(cls, bot: DedicatedBotModel, message_data: dict, sender_id: str):
709
709
  model = cls()
710
710
  model.sender_id = sender_id
711
711
  model.bot_id = bot.id
@@ -1,10 +1,14 @@
1
+ from lgt_jobs.lgt_data.enums import SourceType
1
2
  from lgt_jobs.lgt_data.model import ChatMessage, DedicatedBotModel
2
3
 
3
4
 
4
5
  class MessageRequest(ChatMessage):
5
6
  hidden: bool = False
7
+ source_type: SourceType
6
8
 
7
9
  @classmethod
8
10
  def from_slack_response(cls, bot: DedicatedBotModel, message_data: dict, sender_id: str):
9
11
  message = super().from_slack_response(bot, message_data, sender_id)
10
- return message.from_dic(message.to_dic())
12
+ message_request = MessageRequest.from_dic(message.to_dic())
13
+ message_request.source_type = bot.source.source_type
14
+ return message_request
@@ -10,9 +10,10 @@ from lgt_jobs.lgt_data.model import (LeadModel, BaseModel, UserModel, UserResetP
10
10
  DedicatedBotModel, SlackMemberInformation, UserTemplateModel,
11
11
  ExtendedUserLeadModel, UserLeadModel, ExtendedLeadModel, UserContact, ChatMessage,
12
12
  GroupedMessagesModel, UserVerificationModel, UsersPage, Subscription,
13
- ScheduledMessage, DictionaryModel)
13
+ ScheduledMessage)
14
14
  from datetime import datetime, UTC, timedelta
15
15
  from collections import OrderedDict
16
+ from lgt_jobs.lgt_data.models.message_request import MessageRequest
16
17
 
17
18
  client = MongoClient(os.environ.get('MONGO_CONNECTION_STRING', 'mongodb://127.0.0.1:27017/'))
18
19
 
@@ -1197,6 +1198,10 @@ class ChatRepository(BaseMongoRepository):
1197
1198
  class MessageRequestsRepository(BaseMongoRepository):
1198
1199
  collection_name = 'message_requests'
1199
1200
 
1201
+ def upsert(self, user_id: str, sender_id: str, message_request: MessageRequest):
1202
+ self.collection().update_one({'user_id': to_object_id(user_id), 'sender_id': sender_id},
1203
+ {'$set': message_request.to_dic()}, upsert=True)
1204
+
1200
1205
 
1201
1206
  class UserVerificationMongoRepository(BaseMongoRepository):
1202
1207
  pass