MarioPrzBasto commited on
Commit
ce0e810
verified
1 Parent(s): d4059e5

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -227,11 +227,11 @@ async def list_similar_files():
227
  except FileNotFoundError:
228
  raise HTTPException(status_code=404, detail="Diret贸rio de dados n茫o encontrado")
229
 
230
- @app.get("/files/find/{origin_id}")
231
- async def get_file_by_origin_id(origin_id: int):
232
  try:
233
  for filename in os.listdir(BASE_DIR):
234
- if filename.startswith(f"{origin_id}_") and filename.endswith(".json"):
235
  filepath = os.path.join(BASE_DIR, filename)
236
  if os.path.isfile(filepath):
237
  try:
 
227
  except FileNotFoundError:
228
  raise HTTPException(status_code=404, detail="Diret贸rio de dados n茫o encontrado")
229
 
230
+ @app.get("/files/find/{search}")
231
+ async def search_file(search: str):
232
  try:
233
  for filename in os.listdir(BASE_DIR):
234
+ if f"{search}" in filename and filename.endswith(".json"):
235
  filepath = os.path.join(BASE_DIR, filename)
236
  if os.path.isfile(filepath):
237
  try: