leadguru-jobs 0.424.0__py3-none-any.whl → 0.425.0__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: leadguru_jobs
3
- Version: 0.424.0
3
+ Version: 0.425.0
4
4
  Summary: LGT jobs builds
5
5
  Author-email: developer@leadguru.co
6
6
  Classifier: Development Status :: 5 - Production/Stable
@@ -9,7 +9,7 @@ lgt_jobs/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  lgt_jobs/jobs/analytics.py,sha256=iN1Z9ZtRHrpjzmSN4cbqwL6XzGWQYFmDBnBG-NvmlMc,974
10
10
  lgt_jobs/jobs/archive_leads.py,sha256=Rc9MTWvVUCMEXi7mTrHWKZVyaRiseCFpHqUZcXekmIk,849
11
11
  lgt_jobs/jobs/bot_stats_update.py,sha256=026bu-87lQLJkdVaLMwJH66g7Fo0-Hcxb2Pv0MFX3l0,7187
12
- lgt_jobs/jobs/chat_history.py,sha256=_8ZcpO2s8EFxuL7n_R3shnNsjHz815d1DxB9x7PPAaY,5338
12
+ lgt_jobs/jobs/chat_history.py,sha256=QkB49zyGad1WMA-CKmdWgN6T8upRfDfyAAFmEyrtXqs,5338
13
13
  lgt_jobs/jobs/inbox_leads.py,sha256=HGnhZEzMZw_Yzf40tQIRQc3E3QmcmEUyc1c5KTmJHFI,4646
14
14
  lgt_jobs/jobs/mass_message.py,sha256=jLO-yykQzf-V7JY7a6PFwVoT4z91SJWN5UPrHj_xAP8,2039
15
15
  lgt_jobs/jobs/send_code.py,sha256=ei5WHVpI2w2gv0JGU8wjg0HJYUO_OZqNJPm-W6yO1dA,828
@@ -31,19 +31,19 @@ lgt_jobs/lgt_common/pubsub/messages.py,sha256=rm7uKbxwDTWJqsVA8Kee-4YT58bThjCEV2
31
31
  lgt_jobs/lgt_common/pubsub/pubsubfactory.py,sha256=7HAg_P2sZ6DDJkDyxzc4yI-i38bDSMxySulEGlHUhxc,2441
32
32
  lgt_jobs/lgt_common/slack_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  lgt_jobs/lgt_common/slack_client/methods.py,sha256=-PxK8StkJ-dyACHdRRiQlRL2qaG9KEyWB7wo4eh7ifU,1506
34
- lgt_jobs/lgt_common/slack_client/slack_client.py,sha256=C1FwHQW82OS73THwPRF4_AvyDi4QbYLjbI_NDXO8Nwk,15896
35
- lgt_jobs/lgt_common/slack_client/web_client.py,sha256=oZV7oUcSXXngfMI6oXDedlQWePL9b2ClkocqbXNe1ns,6259
34
+ lgt_jobs/lgt_common/slack_client/slack_client.py,sha256=fpfkk8uBMiTknMwgSNFGiGegN3qoJADJhjbpkpLKO8Y,15896
35
+ lgt_jobs/lgt_common/slack_client/web_client.py,sha256=d3fY_DxuJEr74_QWEitF_U-KAG3aRRyXZb6oH9Qxg80,6259
36
36
  lgt_jobs/lgt_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  lgt_jobs/lgt_data/analytics.py,sha256=qo5nNFQxOTTk8i3tmCq0d3F9iaV9MTIR84SSi6uNrJ8,23427
38
38
  lgt_jobs/lgt_data/engine.py,sha256=iTcLvU7QZvB14hcERQrxSql9cVEcMEzu_tUcWD2Z24A,8076
39
39
  lgt_jobs/lgt_data/enums.py,sha256=A5nWwBgTVW7XaqL30NHNmO0SG_yeDk1dI-U5xrgU2zg,1552
40
40
  lgt_jobs/lgt_data/helpers.py,sha256=58ycqKF1z5nAw0vs6yVCg-SQet107YHyKYXaQUc7M68,157
41
- lgt_jobs/lgt_data/model.py,sha256=4J3WpmnIJ6pNWnSnZFQUnnyeZutDRGP2B3j0JzHdXww,28044
42
- lgt_jobs/lgt_data/mongo_repository.py,sha256=fOBWpJTeYGfiSa-T2k8VwjMIf1qhei83lsRvLndAC78,39840
41
+ lgt_jobs/lgt_data/model.py,sha256=yiDPa2kgOARGMzbRc_heLpu1pRtt4xtf3VcYW7xsjBs,27999
42
+ lgt_jobs/lgt_data/mongo_repository.py,sha256=IbWRDpa6ouwlUA19cLQZCCxMZuiw9nMZakJpUgxVuWk,37670
43
43
  lgt_jobs/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  lgt_jobs/services/web_client.py,sha256=NdVK1Xl8IDqUDZKqYNq219WOO7DtLj3b4VFjP69_MQY,2047
45
45
  lgt_jobs/templates/new_message_mail_template.html,sha256=82XdDPtmkJVUWUcZtgd8bv_9-viAG2WWOnf3AhR6PeY,3635
46
- leadguru_jobs-0.424.0.dist-info/METADATA,sha256=QDOk9D5WVxEcneDvg5z4npd0t_MLBSPSJx281uCt5Uw,1296
47
- leadguru_jobs-0.424.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
48
- leadguru_jobs-0.424.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
49
- leadguru_jobs-0.424.0.dist-info/RECORD,,
46
+ leadguru_jobs-0.425.0.dist-info/METADATA,sha256=tp22IHMl6KNvWrlyfukj7uUejmHDNYeixLbEygXEac4,1296
47
+ leadguru_jobs-0.425.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
48
+ leadguru_jobs-0.425.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
49
+ leadguru_jobs-0.425.0.dist-info/RECORD,,
@@ -67,7 +67,7 @@ class LoadChatHistoryJob(BaseBackgroundJob, ABC):
67
67
  messages = chat_repo.get_list(sender_id=contact.sender_id, bot_id=bot.id)
68
68
  new_messages = []
69
69
  for message in slack_chat:
70
- same_messages = [msg for msg in messages if msg.id == message.id]
70
+ same_messages = [msg for msg in messages if msg.ts == message.ts]
71
71
  if not same_messages:
72
72
  new_messages.append(message)
73
73
  return new_messages
@@ -145,24 +145,24 @@ class SlackClient:
145
145
  url = f'{self.base_url}{SlackMethods.conversations_open}?{self.__im_open_payload(user)}'
146
146
  return requests.post(url=url, cookies=self.cookies).json()
147
147
 
148
- def delete_message(self, channel: str, id: str):
149
- url = f'{self.base_url}{SlackMethods.chat_delete}?{self.__delete_message_payload(channel, id)}'
148
+ def delete_message(self, channel: str, ts: str):
149
+ url = f'{self.base_url}{SlackMethods.chat_delete}?{self.__delete_message_payload(channel, ts)}'
150
150
  return requests.post(url=url, cookies=self.cookies).json()
151
151
 
152
152
  def conversations_info(self, channel: str):
153
153
  url = f'{self.base_url}{SlackMethods.conversations_info}?{self.__conversation_info_payload(channel)}'
154
154
  return requests.post(url=url, cookies=self.cookies).json()
155
155
 
156
- def update_message(self, channel: str, id: str, text: str, file_ids: str):
157
- url = f'{self.base_url}{SlackMethods.chat_update}?{self.__update_message_payload(channel, id, text, file_ids)}'
156
+ def update_message(self, channel: str, ts: str, text: str, file_ids: str):
157
+ url = f'{self.base_url}{SlackMethods.chat_update}?{self.__update_message_payload(channel, ts, text, file_ids)}'
158
158
  return requests.post(url=url, cookies=self.cookies).json()
159
159
 
160
- def conversations_history(self, channel: str, id: str = None):
161
- url = f'{self.base_url}{SlackMethods.conversations_history}?{self.__channel_payload(channel, id)}'
160
+ def conversations_history(self, channel: str, ts: str = None):
161
+ url = f'{self.base_url}{SlackMethods.conversations_history}?{self.__channel_payload(channel, ts)}'
162
162
  return requests.get(url=url, cookies=self.cookies).json()
163
163
 
164
- def conversations_replies(self, channel: str, id: str):
165
- url = f'{self.base_url}{SlackMethods.conversations_replies}?{self.__ts_payload(channel, id)}'
164
+ def conversations_replies(self, channel: str, ts: str):
165
+ url = f'{self.base_url}{SlackMethods.conversations_replies}?{self.__ts_payload(channel, ts)}'
166
166
  return requests.get(url=url, cookies=self.cookies).json()
167
167
 
168
168
  def get_presense(self, user: str = None):
@@ -198,8 +198,8 @@ class SlackClient:
198
198
  url = f'{self.base_url}{SlackMethods.users_info}?{self.__user_info_payload(user)}'
199
199
  return requests.get(url=url, cookies=self.cookies).json()
200
200
 
201
- def get_reactions(self, channel: str, id: str):
202
- url = f'{self.base_url}{SlackMethods.reactions_get}?{self.__get_reactions_payload(channel, id)}'
201
+ def get_reactions(self, channel: str, ts: str):
202
+ url = f'{self.base_url}{SlackMethods.reactions_get}?{self.__get_reactions_payload(channel, ts)}'
203
203
  return requests.get(url=url, cookies=self.cookies).json()
204
204
 
205
205
  def get_attachments(self, channel: str, msg_id: str, url: str):
@@ -303,12 +303,12 @@ class SlackClient:
303
303
  }
304
304
  return parse.urlencode(payload)
305
305
 
306
- def __update_message_payload(self, channel, id, text, file_ids):
306
+ def __update_message_payload(self, channel, ts, text, file_ids):
307
307
  payload = {
308
308
  'parse': 'none',
309
309
  'token': self.token,
310
310
  'channel': channel,
311
- 'ts': id,
311
+ 'ts': ts,
312
312
  'text': text,
313
313
  'file_ids': file_ids
314
314
  }
@@ -322,11 +322,11 @@ class SlackClient:
322
322
  }
323
323
  return parse.urlencode(payload)
324
324
 
325
- def __delete_message_payload(self, channel, id):
325
+ def __delete_message_payload(self, channel, ts):
326
326
  payload = {
327
327
  'token': self.token,
328
328
  'channel': channel,
329
- 'ts': id
329
+ 'ts': ts
330
330
  }
331
331
  return parse.urlencode(payload)
332
332
 
@@ -352,14 +352,14 @@ class SlackClient:
352
352
  }
353
353
  return parse.urlencode(payload)
354
354
 
355
- def __channel_payload(self, channel, id=None):
355
+ def __channel_payload(self, channel, ts=None):
356
356
  payload = {
357
357
  'token': self.token,
358
358
  'channel': channel
359
359
  }
360
360
 
361
- if id:
362
- payload["ts"] = id
361
+ if ts:
362
+ payload["ts"] = ts
363
363
  payload["limit"] = 1
364
364
  payload["inclusive"] = True
365
365
 
@@ -374,19 +374,19 @@ class SlackClient:
374
374
  payload["user"] = user
375
375
  return parse.urlencode(payload)
376
376
 
377
- def __ts_payload(self, channel: str, id: str):
377
+ def __ts_payload(self, channel: str, ts: str):
378
378
  payload = {
379
379
  'token': self.token,
380
380
  'channel': channel,
381
- 'ts': id
381
+ 'ts': ts
382
382
  }
383
383
  return parse.urlencode(payload)
384
384
 
385
- def __get_reactions_payload(self, channel, id):
385
+ def __get_reactions_payload(self, channel, ts):
386
386
  payload = {
387
387
  'token': self.token,
388
388
  'full': True,
389
389
  'channel': channel,
390
- 'timestamp': id
390
+ 'timestamp': ts
391
391
  }
392
392
  return parse.urlencode(payload)
@@ -28,7 +28,7 @@ class SlackMessageConvertService:
28
28
  result.bot_id = bot_id
29
29
  result.text = dic.get('text', '')
30
30
  result.user = dic.get('user', '')
31
- result.id = dic.get('ts', '')
31
+ result.ts = dic.get('ts', '')
32
32
  result.attachments = dic.get('attachments', [])
33
33
  result.files = []
34
34
  result.user_id = to_object_id(user_id)
@@ -51,7 +51,7 @@ class SlackMessageConvertService:
51
51
  new_file.mimetype, cookies)
52
52
  result.files.append(new_file)
53
53
 
54
- js_ticks = int(result.id.split('.')[0] + result.id.split('.')[1][3:])
54
+ js_ticks = int(result.ts.split('.')[0] + result.ts.split('.')[1][3:])
55
55
  result.created_at = datetime.fromtimestamp(js_ticks / 1000.0)
56
56
  return result
57
57
 
@@ -88,11 +88,11 @@ class SlackWebClient:
88
88
 
89
89
  self.client = SlackClient(token, cookies)
90
90
 
91
- def delete_message(self, channel: str, id: str):
92
- return self.client.delete_message(channel, id)
91
+ def delete_message(self, channel: str, ts: str):
92
+ return self.client.delete_message(channel, ts)
93
93
 
94
- def update_message(self, channel: str, id: str, text: str, file_ids=''):
95
- return self.client.update_message(channel, id, text, file_ids)
94
+ def update_message(self, channel: str, ts: str, text: str, file_ids=''):
95
+ return self.client.update_message(channel, ts, text, file_ids)
96
96
 
97
97
  def get_profile(self, user_id):
98
98
  return self.client.user_info(user_id)
@@ -124,8 +124,8 @@ class SlackWebClient:
124
124
  def channel_leave(self, channels):
125
125
  return self.client.leave_channels(channels)
126
126
 
127
- def get_reactions(self, channel, id):
128
- return self.client.get_reactions(channel, id)
127
+ def get_reactions(self, channel, ts):
128
+ return self.client.get_reactions(channel, ts)
129
129
 
130
130
  def upload_file(self, file, file_name):
131
131
  return self.client.upload_file(file, file_name)
@@ -151,8 +151,8 @@ class SlackWebClient:
151
151
  def find_workspaces(self, user_agent: str, ) -> requests.Response:
152
152
  return self.client.find_workspaces(user_agent)
153
153
 
154
- def conversation_replies(self, channel: str, id: str) -> dict:
155
- return self.client.conversations_replies(channel, id)
154
+ def conversation_replies(self, channel: str, ts: str) -> dict:
155
+ return self.client.conversations_replies(channel, ts)
156
156
 
157
157
  def create_shared_invite(self):
158
158
  return self.client.create_shared_invite()
@@ -576,7 +576,7 @@ class ChatMessage:
576
576
  sender_id: str
577
577
  text: str
578
578
  user: str
579
- id: str
579
+ ts: str
580
580
  viewed: bool
581
581
  files: list
582
582
  attachments: list[dict] | None
@@ -601,7 +601,7 @@ class ChatMessage:
601
601
  self.text: str = ''
602
602
  self.created_at: datetime
603
603
  self.user = ''
604
- self.id = ''
604
+ self.ts = ''
605
605
  self.files = []
606
606
  self.attachments = []
607
607
 
@@ -712,7 +712,7 @@ class BoardModel(BaseModel):
712
712
  super().__init__()
713
713
  self.name = None
714
714
  self.user_id = None
715
- self.statuses: List[BoardedStatus] = []
715
+ self.statuses = list()
716
716
  self.is_primary = None
717
717
  self.default = False
718
718
 
@@ -748,7 +748,6 @@ class BoardedStatus:
748
748
  self.order = 0
749
749
  self.is_primary = False
750
750
  self.default = False
751
- self.user_leads = 0
752
751
 
753
752
  def to_dic(self):
754
753
  self.id = self.name
@@ -708,64 +708,6 @@ class BoardsMongoRepository(BaseMongoRepository):
708
708
  docs = self.collection().find(pipeline).sort('created_at', 1)
709
709
  return [BoardModel.from_dic(doc) for doc in docs]
710
710
 
711
- def get_with_stats(self, user_id: str, **kwargs):
712
- is_primary = kwargs.get('is_primary')
713
- default = kwargs.get('default')
714
- name = kwargs.get('name')
715
- match = {'user_id': to_object_id(user_id)}
716
-
717
- if is_primary is not None:
718
- match['is_primary'] = is_primary
719
-
720
- if default is not None:
721
- match['default'] = default
722
-
723
- if name:
724
- match['name'] = name
725
-
726
- pipeline = [
727
- {
728
- '$match': match
729
- },
730
- {
731
- '$unwind': {'path': '$statuses', 'preserveNullAndEmptyArrays': False}
732
- },
733
- {
734
- '$lookup': {
735
- 'from': 'user_leads',
736
- 'as': 'statuses.user_leads',
737
- 'let': {'id': '$_id', 'status': '$statuses.name'},
738
- 'pipeline': [
739
- {
740
- '$match': {
741
- '$expr': {
742
- '$and': [
743
- {'$eq': ['$board_id', '$$id']},
744
- {'$eq': ['$status', '$$status']}
745
- ]
746
- }
747
- }
748
- }
749
- ]
750
- }
751
- },
752
- {
753
- '$addFields': {'statuses.user_leads': {'$size': '$statuses.user_leads'}}
754
- },
755
- {
756
- '$group': {
757
- '_id': '$_id',
758
- 'statuses': {'$push': '$statuses'},
759
- 'name': {'$first': '$name'},
760
- 'created_at': {'$first': '$created_at'},
761
- 'user_id': {'$first': '$user_id'},
762
- 'is_primary': {'$first': '$is_primary'},
763
- 'default': {'$first': '$default'}}
764
- },
765
- {'$sort': {'created_at': 1}}]
766
-
767
- return [BoardModel.from_dic(doc) for doc in self.collection().aggregate(pipeline)]
768
-
769
711
  def get_primary(self, user_id: str):
770
712
  return BoardModel.from_dic(self.collection().find_one({'user_id': to_object_id(user_id), 'is_primary': True}))
771
713
 
@@ -1077,11 +1019,8 @@ class ChatRepository(BaseMongoRepository):
1077
1019
  pipeline['sender_id'] = sender_id
1078
1020
 
1079
1021
  return [ChatMessage.from_dic(msg)
1080
- for msg in self.collection().find(pipeline).sort("id", pymongo.ASCENDING)]
1022
+ for msg in self.collection().find(pipeline).sort("ts", pymongo.ASCENDING)]
1081
1023
 
1082
1024
  def upsert_messages(self, messages: list[dict]):
1083
- operations = [UpdateOne({"id": msg['id']}, {'$set': msg}, upsert=True) for msg in messages]
1025
+ operations = [UpdateOne({"ts": msg['ts']}, {'$set': msg}, upsert=True) for msg in messages]
1084
1026
  self.collection().bulk_write(operations)
1085
-
1086
- def delete_message(self, user_id: str, _id: str):
1087
- self.collection().delete_one({"id": _id, 'user_id': to_object_id(user_id)})