routers -> routers.v1
This commit is contained in:
parent
fbf6c550d2
commit
53dd8d74fa
10 changed files with 41 additions and 41 deletions
|
@ -10,7 +10,7 @@ from fastapi import FastAPI
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
|
||||||
from .routers import main_router
|
from .routers.v1 import router as v1_router
|
||||||
from .settings import SETTINGS
|
from .settings import SETTINGS
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
|
@ -29,7 +29,7 @@ app = FastAPI(
|
||||||
redoc_url=SETTINGS.redoc_url,
|
redoc_url=SETTINGS.redoc_url,
|
||||||
)
|
)
|
||||||
|
|
||||||
app.include_router(main_router)
|
app.include_router(v1_router)
|
||||||
|
|
||||||
if SETTINGS.production_mode:
|
if SETTINGS.production_mode:
|
||||||
# Mount frontend in production mode
|
# Mount frontend in production mode
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
"""
|
|
||||||
Package `routers`: Each module contains the path operations for their prefixes.
|
|
||||||
|
|
||||||
This file: Main API router definition.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from fastapi import APIRouter
|
|
||||||
|
|
||||||
from . import aggregate, calendar, image, misc, text, ticker
|
|
||||||
|
|
||||||
main_router = APIRouter(prefix="/api/v1")
|
|
||||||
|
|
||||||
main_router.include_router(misc.router)
|
|
||||||
|
|
||||||
main_router.include_router(text.router)
|
|
||||||
main_router.include_router(ticker.router)
|
|
||||||
main_router.include_router(image.router)
|
|
||||||
|
|
||||||
main_router.include_router(calendar.router)
|
|
||||||
main_router.include_router(aggregate.router)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"main_router",
|
|
||||||
]
|
|
24
api/ovdashboard_api/routers/v1/__init__.py
Normal file
24
api/ovdashboard_api/routers/v1/__init__.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
"""
|
||||||
|
Package `routers`: Each module contains the path operations for their prefixes.
|
||||||
|
|
||||||
|
This file: Main API router definition.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from fastapi import APIRouter
|
||||||
|
|
||||||
|
from . import aggregate, calendar, image, misc, text, ticker
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/api/v1")
|
||||||
|
|
||||||
|
router.include_router(misc.router)
|
||||||
|
|
||||||
|
router.include_router(text.router)
|
||||||
|
router.include_router(ticker.router)
|
||||||
|
router.include_router(image.router)
|
||||||
|
|
||||||
|
router.include_router(calendar.router)
|
||||||
|
router.include_router(aggregate.router)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"router",
|
||||||
|
]
|
|
@ -10,8 +10,8 @@ from typing import Iterator, Protocol
|
||||||
from fastapi import HTTPException, status
|
from fastapi import HTTPException, status
|
||||||
from webdav3.exceptions import RemoteResourceNotFound
|
from webdav3.exceptions import RemoteResourceNotFound
|
||||||
|
|
||||||
from ..config import Config
|
from ...config import Config
|
||||||
from ..dav_common import caldav_list, webdav_list
|
from ...dav_common import caldav_list, webdav_list
|
||||||
|
|
||||||
_logger = getLogger(__name__)
|
_logger = getLogger(__name__)
|
||||||
|
|
|
@ -12,7 +12,7 @@ from typing import Iterator
|
||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends
|
||||||
from ovdashboard_api.config import Config
|
from ovdashboard_api.config import Config
|
||||||
|
|
||||||
from ..dav_calendar import CalEvent, DavCalendar
|
from ...dav_calendar import CalEvent, DavCalendar
|
||||||
from ._common import AggregateNameLister, PrefixFinder, PrefixUnique
|
from ._common import AggregateNameLister, PrefixFinder, PrefixUnique
|
||||||
from .calendar import calendar_unique
|
from .calendar import calendar_unique
|
||||||
|
|
|
@ -11,8 +11,8 @@ from typing import Iterator
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
from ..config import CalendarUIConfig, Config
|
from ...config import CalendarUIConfig, Config
|
||||||
from ..dav_calendar import CalEvent, DavCalendar
|
from ...dav_calendar import CalEvent, DavCalendar
|
||||||
from ._common import CalendarNameLister, PrefixFinder, PrefixUnique
|
from ._common import CalendarNameLister, PrefixFinder, PrefixUnique
|
||||||
|
|
||||||
_logger = getLogger(__name__)
|
_logger = getLogger(__name__)
|
|
@ -15,9 +15,9 @@ from fastapi import APIRouter, Depends
|
||||||
from fastapi.responses import StreamingResponse
|
from fastapi.responses import StreamingResponse
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from ..config import Config, ImageUIConfig
|
from ...config import Config, ImageUIConfig
|
||||||
from ..dav_common import webdav_ensure_path
|
from ...dav_common import webdav_ensure_path
|
||||||
from ..dav_file import DavFile
|
from ...dav_file import DavFile
|
||||||
from ._common import FileNameLister, PrefixFinder, PrefixUnique
|
from ._common import FileNameLister, PrefixFinder, PrefixUnique
|
||||||
|
|
||||||
_logger = getLogger(__name__)
|
_logger = getLogger(__name__)
|
|
@ -11,8 +11,8 @@ from socket import AF_INET, SOCK_DGRAM, socket
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
from ..config import Config, LogoUIConfig, ServerUIConfig
|
from ...config import Config, LogoUIConfig, ServerUIConfig
|
||||||
from ..settings import SETTINGS
|
from ...settings import SETTINGS
|
||||||
|
|
||||||
_logger = getLogger(__name__)
|
_logger = getLogger(__name__)
|
||||||
|
|
|
@ -14,8 +14,8 @@ from typing import Iterator
|
||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends
|
||||||
from markdown import markdown
|
from markdown import markdown
|
||||||
|
|
||||||
from ..dav_common import webdav_ensure_path
|
from ...dav_common import webdav_ensure_path
|
||||||
from ..dav_file import DavFile
|
from ...dav_file import DavFile
|
||||||
from ._common import FileNameLister, PrefixFinder, PrefixUnique
|
from ._common import FileNameLister, PrefixFinder, PrefixUnique
|
||||||
|
|
||||||
_logger = getLogger(__name__)
|
_logger = getLogger(__name__)
|
|
@ -12,9 +12,9 @@ from typing import Iterator
|
||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends
|
||||||
from markdown import markdown
|
from markdown import markdown
|
||||||
|
|
||||||
from ..config import Config, TickerUIConfig
|
from ...config import Config, TickerUIConfig
|
||||||
from ..dav_common import webdav_ensure_path
|
from ...dav_common import webdav_ensure_path
|
||||||
from ..dav_file import DavFile
|
from ...dav_file import DavFile
|
||||||
from .text import text_lister, text_unique
|
from .text import text_lister, text_unique
|
||||||
|
|
||||||
_logger = getLogger(__name__)
|
_logger = getLogger(__name__)
|
Loading…
Reference in a new issue