Files
jobboard/roledesk/web/deps.py
T
WolfandClaude Sonnet 5 b44f78ca7e Serve one alpha page: filters, roles, the tracker, and Jobs
/, GET /api/roles|companies|applications, POST /api/companies/{key}/affinity
and /api/applications[/{id}/status]. The Jinja2 template renders an empty
shell; static/app.js fills it and drives Save, affinity and status changes.
<desk-jobs> from pipeline.web mounts at the bottom so Pull can be started
from the page.

Store.roles gains q, function, remote, days and hide_muted, and company/
place move from a key match to a substring on the text a board wrote.
hide_muted filters in SQL before LIMIT: filtering after it shipped first and
broke immediately on real data, since Databricks' freshly pulled 884 roles
were the newest 200-plus rows in the table and muting it left nothing to
show.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-23 11:56:10 +02:00

28 lines
822 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
`roledesk/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 roledesk.storage import Store
def get_store(request: HTTPConnection) -> Store:
return request.app.state.store
StoreDep = Annotated[Store, Depends(get_store)]