mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 13:22:12 +00:00
Only allow supported search types to /search, /regenerate APIs
- Use a SearchType to limit types that can be passed by user - FastAPI automatically validates type passed in query param - Available type options show up in Swagger UI, FastAPI docs - controller code looks neater instead of doing string comparisons for type - Test invalid, valid search types via pytest
This commit is contained in:
9
src/utils/config.py
Normal file
9
src/utils/config.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class SearchType(str, Enum):
|
||||
Notes = "notes"
|
||||
Ledger = "ledger"
|
||||
Music = "music"
|
||||
Image = "image"
|
||||
|
||||
Reference in New Issue
Block a user