Spaces:
Running
Running
BinaryONe
commited on
Commit
·
874b4fe
1
Parent(s):
0714d01
Copilot Modifications
Browse files
FileStream/Database/database.py
CHANGED
@@ -7,7 +7,7 @@ from bson.errors import InvalidId
|
|
7 |
from bson.json_util import dumps
|
8 |
|
9 |
#----------------------Local Imports-----------------------#
|
10 |
-
from FileStream.Exceptions import
|
11 |
from FileStream.Tools import Time_ISTKolNow
|
12 |
|
13 |
|
@@ -165,10 +165,10 @@ class Database:
|
|
165 |
file_info = await self.files.find_one({"_id": ObjectId(_id)})
|
166 |
if not file_info:
|
167 |
print('file not found')
|
168 |
-
#raise
|
169 |
return file_info
|
170 |
except InvalidId:
|
171 |
-
raise
|
172 |
|
173 |
async def get_all_files_api(self,range=None):
|
174 |
#files = self.files.find({})
|
@@ -277,10 +277,10 @@ class Database:
|
|
277 |
try:
|
278 |
file_info = await self.pfile.find_one({"_id": ObjectId(_id)})
|
279 |
if not file_info:
|
280 |
-
raise
|
281 |
return file_info
|
282 |
except InvalidId:
|
283 |
-
raise
|
284 |
|
285 |
async def add_private_file(self, file_info):
|
286 |
file_info["time"] = Time_ISTKolNow()
|
|
|
7 |
from bson.json_util import dumps
|
8 |
|
9 |
#----------------------Local Imports-----------------------#
|
10 |
+
from FileStream.Exceptions import FileNotFound
|
11 |
from FileStream.Tools import Time_ISTKolNow
|
12 |
|
13 |
|
|
|
165 |
file_info = await self.files.find_one({"_id": ObjectId(_id)})
|
166 |
if not file_info:
|
167 |
print('file not found')
|
168 |
+
#raise FileNotFound
|
169 |
return file_info
|
170 |
except InvalidId:
|
171 |
+
raise FileNotFound
|
172 |
|
173 |
async def get_all_files_api(self,range=None):
|
174 |
#files = self.files.find({})
|
|
|
277 |
try:
|
278 |
file_info = await self.pfile.find_one({"_id": ObjectId(_id)})
|
279 |
if not file_info:
|
280 |
+
raise FileNotFound
|
281 |
return file_info
|
282 |
except InvalidId:
|
283 |
+
raise FileNotFound
|
284 |
|
285 |
async def add_private_file(self, file_info):
|
286 |
file_info["time"] = Time_ISTKolNow()
|