Skip to content

Commit 4667717

Browse files
committed
(fix): implementing feedback changes & testing cli pipeline
1 parent 5efaaff commit 4667717

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

mflix/server/python-fastapi/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,15 @@ async def ensure_standard_index():
122122
try:
123123
comments_collection = db.get_collection("comments")
124124

125-
existing_indexes_cursor = await comments_collection.list_search_indexes()
125+
existing_indexes_cursor = await comments_collection.list_indexes()
126126
existing_indexes = await existing_indexes_cursor.to_list(length=None)
127127
index_names = [index.get("name") for index in existing_indexes]
128128

129-
if "movie_id" not in index_names:
130-
await comments_collection.create_index("movie_id")
129+
print(f"Existing indexes: {existing_indexes}")
130+
131+
standard_index_name = "movie_id_index"
132+
if standard_index_name not in index_names:
133+
await comments_collection.create_index("movie_id", name=standard_index_name)
131134

132135
except Exception as e:
133136
print(f"Failed to create standard index on 'comments' collection: {str(e)}. ")

mflix/server/python-fastapi/src/database/mongo_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ def get_collection(name:str):
1818
def voyage_ai_available():
1919
"""Check if Voyage API Key is available and valid."""
2020
api_key = os.getenv("VOYAGE_API_KEY")
21+
if api_key is None or api_key =="your_voyage_api_key":
22+
return None
2123
return api_key is not None and api_key.strip() != ""

mflix/server/python-fastapi/src/routers/movies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ async def update_movies_batch(
757757
result = await movies_collection.update_many(filter_data, {"$set": update_data})
758758
except Exception as e:
759759
raise HTTPException(
760-
status_code = "500",
760+
status_code = 500,
761761
detail=f"An error occurred while updating movies: {str(e)}"
762762
)
763763

0 commit comments

Comments
 (0)