leadguru-jobs 0.414.0__py3-none-any.whl → 0.416.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.414.0
3
+ Version: 0.416.0
4
4
  Summary: LGT jobs builds
5
5
  Author-email: developer@leadguru.co
6
6
  Classifier: Development Status :: 5 - Production/Stable
@@ -38,12 +38,12 @@ lgt_jobs/lgt_data/analytics.py,sha256=qo5nNFQxOTTk8i3tmCq0d3F9iaV9MTIR84SSi6uNrJ
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=yiDPa2kgOARGMzbRc_heLpu1pRtt4xtf3VcYW7xsjBs,27999
42
- lgt_jobs/lgt_data/mongo_repository.py,sha256=jVayqxxshJy4YF7DIlVTNdpuBc1eCTYhkT-INfl8qFs,37331
41
+ lgt_jobs/lgt_data/model.py,sha256=Z0Www576hBMSCnvQEEiEW78Kzeh3-To2S6xhHM-p7z8,27970
42
+ lgt_jobs/lgt_data/mongo_repository.py,sha256=GpYqa9V24zFB78mFW6RfB2sRWidijzYUhyIhLK6Gf_c,37419
43
43
  lgt_jobs/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  lgt_jobs/services/web_client.py,sha256=D3y5KVVBk7mesRnsiByx4tFmNbfTOKOUoIp3VCHuk0I,1983
45
45
  lgt_jobs/templates/new_message_mail_template.html,sha256=82XdDPtmkJVUWUcZtgd8bv_9-viAG2WWOnf3AhR6PeY,3635
46
- leadguru_jobs-0.414.0.dist-info/METADATA,sha256=mUtaEYXLyarGmxZE6Fr2PF0tj_CIzC1iKhhOEFgV8_I,1296
47
- leadguru_jobs-0.414.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
48
- leadguru_jobs-0.414.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
49
- leadguru_jobs-0.414.0.dist-info/RECORD,,
46
+ leadguru_jobs-0.416.0.dist-info/METADATA,sha256=bV5A7ljvZqbyI5gN_aq1T_TIbFgSe89iJPpVA8C_4bc,1296
47
+ leadguru_jobs-0.416.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
48
+ leadguru_jobs-0.416.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
49
+ leadguru_jobs-0.416.0.dist-info/RECORD,,
@@ -112,7 +112,6 @@ class BaseBotModel(Credentials):
112
112
  self.banned: bool = False
113
113
  self.associated_user = None
114
114
  self.type: SourceType | None = None
115
- self.deleted = False
116
115
 
117
116
 
118
117
  class DedicatedBotModel(BaseBotModel):
@@ -767,6 +767,17 @@ class DedicatedBotRepository(BaseMongoRepository):
767
767
  docs = self.collection().find(pipeline)
768
768
  return [DedicatedBotModel.from_dic(doc) for doc in docs]
769
769
 
770
+ def get_source_ids_for_user(self, user_id, source_type):
771
+ docs = self.collection().find({
772
+ 'user_id': user_id,
773
+ 'source.source_type': source_type
774
+ }, {
775
+ '_id': 0,
776
+ 'source_id': '$source.source_id'
777
+ })
778
+ source_ids = [item['source_id'] for item in docs]
779
+ return source_ids
780
+
770
781
  def get_one(self, **kwargs):
771
782
  pipeline = self.__create_bots_filter(**kwargs)
772
783
  return DedicatedBotModel.from_dic(self.collection().find_one(pipeline))
@@ -991,24 +1002,11 @@ class TeamRepository(BaseMongoRepository):
991
1002
  class ChatRepository(BaseMongoRepository):
992
1003
  collection_name = 'chat_messages'
993
1004
 
994
- def get_list(self, **kwargs):
995
- pipeline = {}
996
- text = kwargs.get('text')
997
- user_id = kwargs.get('user_id')
998
- bot_id = kwargs.get('bot_id')
999
- sender_id = kwargs.get('sender_id')
1000
-
1001
- if text:
1002
- pipeline['text'] = {"$regex": text, "$options": 'i'}
1003
- if bot_id:
1004
- pipeline['bot_id'] = to_object_id(bot_id)
1005
- if user_id:
1006
- pipeline['user_id'] = to_object_id(user_id)
1007
- if sender_id:
1008
- pipeline['sender_id'] = sender_id
1009
-
1005
+ def get_list(self, sender_id: str, bot_id: ObjectId):
1010
1006
  return [ChatMessage.from_dic(msg)
1011
- for msg in self.collection().find(pipeline).sort("ts", pymongo.ASCENDING)]
1007
+ for msg in self.collection().find({'sender_id': sender_id,
1008
+ 'bot_id': to_object_id(bot_id)}).sort("ts",
1009
+ pymongo.ASCENDING)]
1012
1010
 
1013
1011
  def upsert_messages(self, messages: list[dict]):
1014
1012
  operations = [UpdateOne({"ts": msg['ts']}, {'$set': msg}, upsert=True) for msg in messages]