What a pull reads can now be changed on a page instead of only the command line: try a search and see its first ten results before saving it, edit or remove one, follow a company's ATS board, switch any board or search on or off, and preview and apply a prune by region. Each row shows its open roles and the countries they are in. The page and `app companies`/`app searches` call the same functions in app/jobs/sources.py. Switching a target off closes its open roles, and the pull's settle closes them again if a batch in flight reopened them. Roles pulled before `country` existed are backfilled at startup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
984 B
Python
36 lines
984 B
Python
"""How a route reaches the store.
|
|
|
|
Built once by the app's factory and parked on `app.state`; a route asks for
|
|
it as a dependency rather than closing over it, the same split newsdesk's
|
|
`web/deps.py` makes and for the same reason — a router module stays
|
|
importable, and testable, on its own.
|
|
|
|
Not a `yield` dependency: `Store` holds no connection between calls (see
|
|
`app/storage/store.py`), so there is nothing to close, and building one
|
|
per request would take SQLite's write lock for a plain read.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Annotated
|
|
|
|
from fastapi import Depends
|
|
from starlette.requests import HTTPConnection
|
|
|
|
from app.config import Config
|
|
from app.storage import Store
|
|
|
|
|
|
def get_store(request: HTTPConnection) -> Store:
|
|
return request.app.state.store
|
|
|
|
|
|
StoreDep = Annotated[Store, Depends(get_store)]
|
|
|
|
|
|
def get_config(request: HTTPConnection) -> Config:
|
|
return request.app.state.config
|
|
|
|
|
|
ConfigDep = Annotated[Config, Depends(get_config)]
|