BinaryONe commited on
Commit
36e3ca7
·
1 Parent(s): 0d8a300

DB Pos changes

Browse files
FileStream/Database/database.py CHANGED
@@ -163,6 +163,16 @@ class Database:
163
 
164
  # ---------------------[ FIND FILE IN DB for Bot and APIs]---------------------#
165
  async def get_file(self, _id, privacy_type:str ):
 
 
 
 
 
 
 
 
 
 
166
  if privacy_type == "PUBLIC":
167
  try:
168
  file_info = await self.files.find_one({"_id": ObjectId(_id)})
 
163
 
164
  # ---------------------[ FIND FILE IN DB for Bot and APIs]---------------------#
165
  async def get_file(self, _id, privacy_type:str ):
166
+ try:
167
+ file_info = await self.files.find_one({"_id": ObjectId(_id)})
168
+ if not file_info:
169
+ file_info = await self.tfiles.find_one({"_id": ObjectId(_id)})
170
+ #raise FileNotFound
171
+ return file_info
172
+ except InvalidId:
173
+ raise FileNotFound
174
+
175
+ async def get_file_old(self, _id, privacy_type:str ):
176
  if privacy_type == "PUBLIC":
177
  try:
178
  file_info = await self.files.find_one({"_id": ObjectId(_id)})
FileStream/utils/FileProcessors/file_properties.py CHANGED
@@ -83,7 +83,7 @@ async def get_file_ids(client: Client | bool, db_id: str, message) -> Optional[F
83
  log_msg = await send_file(FileStream, db_id, file_info, message, source)
84
  #updated_info = update_file_info(log_msg)
85
  await db.update_file_info(db_id, update_file_info(log_msg), file_info['privacy_type'])
86
- await db.update_file_ids(db_id, await update_file_id(await db.get_file(db_id,file_info['privacy_type']),MULTI_CLIENTS), file_info['privacy_type'])
87
 
88
  logging.debug("Stored file_id of all clients in DB")
89
  if not client:
 
83
  log_msg = await send_file(FileStream, db_id, file_info, message, source)
84
  #updated_info = update_file_info(log_msg)
85
  await db.update_file_info(db_id, update_file_info(log_msg), file_info['privacy_type'])
86
+ await db.update_file_ids(db_id, await update_file_id(await db.get_file(db_id),MULTI_CLIENTS), file_info['privacy_type'])
87
 
88
  logging.debug("Stored file_id of all clients in DB")
89
  if not client: