Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update API Docs #3856

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions mealie/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,24 @@

settings = get_app_settings()

description = f"""
description = """
Mealie is a web application for managing your recipes, meal plans, and shopping lists. This is the Restful
API interactive documentation that can be used to explore the API. If you're justing getting started with
the API and want to get started quickly, you can use the
[API Usage | Mealie Docs](https://nightly.mealie.io/documentation/getting-started/api-usage/)
[API Usage | Mealie Docs](https://docs.mealie.io/documentation/getting-started/api-usage/)
as a reference for how to get started.


As of this release <b>{APP_VERSION}</b>, Mealie is still in rapid development and therefore some of these APIs may
change from version to version.


If you have any questions or comments about mealie, please use the discord server to talk to the developers or other
community members. If you'd like to file an issue, please use the
[GitHub Issue Tracker | Mealie](https://github.com/mealie-recipes/mealie/issues/new/choose)


## Helpful Links
- [Home Page](https://mealie.io)
- [Documentation](https://nightly.mealie.io)
- [Documentation](https://docs.mealie.io)
- [Discord](https://discord.gg/QuStdQGSGK)
- [Demo](https://demo.mealie.io)
- [Beta](https://demo.mealie.io)
"""

logger = get_logger()
Expand Down
2 changes: 1 addition & 1 deletion mealie/routes/_base/base_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class BaseCrudController(BaseUserController):
Base class for all CRUD controllers to facilitate common CRUD functions.
"""

event_bus: EventBusService = Depends(EventBusService.create)
event_bus: EventBusService = Depends(EventBusService.as_dependency)

def publish_event(self, event_type: EventTypes, document_data: EventDocumentDataBase, message: str = "") -> None:
self.event_bus.dispatch(
Expand Down
2 changes: 1 addition & 1 deletion mealie/routes/admin/admin_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from mealie.schema.analytics.analytics import MealieAnalytics
from mealie.services.analytics.service_analytics import AnalyticsService

router = APIRouter(prefix="/analytics")
router = APIRouter(prefix="/analytics", include_in_schema=False) # deprecated - use statistics route instead


@controller(router)
Expand Down
2 changes: 1 addition & 1 deletion mealie/routes/groups/controller_group_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

@controller(router)
class GroupEventsNotifierController(BaseUserController):
event_bus: EventBusService = Depends(EventBusService.create)
event_bus: EventBusService = Depends(EventBusService.as_dependency)

@cached_property
def repo(self):
Expand Down
4 changes: 2 additions & 2 deletions mealie/routes/spa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,6 @@ def mount_spa(app: FastAPI):
global __contents
__contents = pathlib.Path(__app_settings.STATIC_FILES).joinpath("index.html").read_text()

app.get("/g/{group_slug}/r/{recipe_slug}")(serve_recipe_with_meta)
app.get("/g/{group_slug}/shared/r/{token_id}")(serve_shared_recipe_with_meta)
app.get("/g/{group_slug}/r/{recipe_slug}", include_in_schema=False)(serve_recipe_with_meta)
app.get("/g/{group_slug}/shared/r/{token_id}", include_in_schema=False)(serve_shared_recipe_with_meta)
app.mount("/", SPAStaticFiles(directory=__app_settings.STATIC_FILES, html=True), name="spa")
2 changes: 1 addition & 1 deletion mealie/routes/users/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@controller(router)
class RegistrationController(BasePublicController):
event_bus: EventBusService = Depends(EventBusService.create)
event_bus: EventBusService = Depends(EventBusService.as_dependency)

@router.post("", response_model=UserOut, status_code=status.HTTP_201_CREATED)
def register_new_user(self, data: CreateUserRegistration):
Expand Down
2 changes: 1 addition & 1 deletion mealie/routes/validators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

router = APIRouter()

router.include_router(validators.router, prefix=prefix, tags=["Validators"])
router.include_router(validators.router, prefix=prefix, tags=["Validators"], include_in_schema=False)
10 changes: 8 additions & 2 deletions mealie/services/event_bus_service/event_bus_service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from fastapi import BackgroundTasks, Depends
from fastapi import BackgroundTasks, Depends, Query
from pydantic import UUID4
from sqlalchemy.orm.session import Session

Expand Down Expand Up @@ -84,5 +84,11 @@ def publish_event(self, event: Event) -> None:
listener.publish_to_subscribers(event, subscribers)

@classmethod
def create(cls, bg: BackgroundTasks, session=Depends(generate_session), group_id: UUID4 | None = None):
def as_dependency(
cls,
bg: BackgroundTasks,
session=Depends(generate_session),
group_id: UUID4 | None = Query(None, include_in_schema=False),
):
"""Convenience method to use as a dependency in FastAPI routes"""
return cls(bg, session, group_id)
Loading