mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-02 20:15:24 +02:00
* feat: server side search API (#2112) * refactor repository_recipes filter building * add food filter to recipe repository page_all * fix query type annotations * working search * add tests and make sure title matches are ordered correctly * remove instruction matching again * fix formatting and small issues * fix another linting error * make search test no rely on actual words * fix failing postgres compiled query * revise incorrectly ordered migration * automatically extract latest migration version * test migration orderes * run type generators * new search function * wip: new search page * sortable field options * fix virtual scroll issue * fix search casing bug * finalize search filters/sorts * remove old composable * fix type errors --------- Co-authored-by: Sören <fleshgolem@gmx.net>
This commit is contained in:
parent
fc105dcebc
commit
71f8c1066a
36 changed files with 1057 additions and 822 deletions
38
tests/utils/alembic_reader.py
Normal file
38
tests/utils/alembic_reader.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
import importlib.util
|
||||
import pathlib
|
||||
from functools import lru_cache
|
||||
|
||||
from mealie.db.init_db import PROJECT_DIR
|
||||
|
||||
ALEMBIC_MIGRATIONS = PROJECT_DIR / "alembic" / "versions"
|
||||
|
||||
|
||||
def import_file(module_name: str, file_path: pathlib.Path):
|
||||
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
||||
|
||||
if spec is None or spec.loader is None:
|
||||
raise ImportError(f"Unable to import {module_name} from {file_path}")
|
||||
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
def latest_alembic_version() -> str:
|
||||
latest = sorted(ALEMBIC_MIGRATIONS.glob("*.py"))[-1] # Assumes files are named in order
|
||||
|
||||
mod = import_file("alembic_version", latest)
|
||||
|
||||
revision = getattr(mod, "revision", None)
|
||||
|
||||
if revision is None:
|
||||
raise Exception(f"Unable to find revision in {latest}")
|
||||
|
||||
return revision
|
||||
|
||||
|
||||
@lru_cache(1)
|
||||
def alembic_versions():
|
||||
return [
|
||||
{"version_num": latest_alembic_version()},
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue