diff --git a/api/ovdashboard_api/app.py b/api/ovdashboard_api/app.py index 41c7a11..d9e0365 100644 --- a/api/ovdashboard_api/app.py +++ b/api/ovdashboard_api/app.py @@ -10,7 +10,7 @@ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi.staticfiles import StaticFiles -from .routers import main_router +from .routers.v1 import router as v1_router from .settings import SETTINGS app = FastAPI( @@ -29,7 +29,7 @@ app = FastAPI( redoc_url=SETTINGS.redoc_url, ) -app.include_router(main_router) +app.include_router(v1_router) if SETTINGS.production_mode: # Mount frontend in production mode diff --git a/api/ovdashboard_api/routers/__init__.py b/api/ovdashboard_api/routers/__init__.py index 95471ba..e69de29 100644 --- a/api/ovdashboard_api/routers/__init__.py +++ b/api/ovdashboard_api/routers/__init__.py @@ -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", -] diff --git a/api/ovdashboard_api/routers/v1/__init__.py b/api/ovdashboard_api/routers/v1/__init__.py new file mode 100644 index 0000000..11ffd1e --- /dev/null +++ b/api/ovdashboard_api/routers/v1/__init__.py @@ -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", +] diff --git a/api/ovdashboard_api/routers/_common.py b/api/ovdashboard_api/routers/v1/_common.py similarity index 98% rename from api/ovdashboard_api/routers/_common.py rename to api/ovdashboard_api/routers/v1/_common.py index 4009b81..a7fd440 100644 --- a/api/ovdashboard_api/routers/_common.py +++ b/api/ovdashboard_api/routers/v1/_common.py @@ -10,8 +10,8 @@ from typing import Iterator, Protocol from fastapi import HTTPException, status from webdav3.exceptions import RemoteResourceNotFound -from ..config import Config -from ..dav_common import caldav_list, webdav_list +from ...config import Config +from ...dav_common import caldav_list, webdav_list _logger = getLogger(__name__) diff --git a/api/ovdashboard_api/routers/aggregate.py b/api/ovdashboard_api/routers/v1/aggregate.py similarity index 97% rename from api/ovdashboard_api/routers/aggregate.py rename to api/ovdashboard_api/routers/v1/aggregate.py index cd04da3..fdf21ee 100644 --- a/api/ovdashboard_api/routers/aggregate.py +++ b/api/ovdashboard_api/routers/v1/aggregate.py @@ -12,7 +12,7 @@ from typing import Iterator from fastapi import APIRouter, Depends 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 .calendar import calendar_unique diff --git a/api/ovdashboard_api/routers/calendar.py b/api/ovdashboard_api/routers/v1/calendar.py similarity index 93% rename from api/ovdashboard_api/routers/calendar.py rename to api/ovdashboard_api/routers/v1/calendar.py index 06a8fe5..72328d4 100644 --- a/api/ovdashboard_api/routers/calendar.py +++ b/api/ovdashboard_api/routers/v1/calendar.py @@ -11,8 +11,8 @@ from typing import Iterator from fastapi import APIRouter, Depends -from ..config import CalendarUIConfig, Config -from ..dav_calendar import CalEvent, DavCalendar +from ...config import CalendarUIConfig, Config +from ...dav_calendar import CalEvent, DavCalendar from ._common import CalendarNameLister, PrefixFinder, PrefixUnique _logger = getLogger(__name__) diff --git a/api/ovdashboard_api/routers/image.py b/api/ovdashboard_api/routers/v1/image.py similarity index 94% rename from api/ovdashboard_api/routers/image.py rename to api/ovdashboard_api/routers/v1/image.py index 6714544..fb10b5c 100644 --- a/api/ovdashboard_api/routers/image.py +++ b/api/ovdashboard_api/routers/v1/image.py @@ -15,9 +15,9 @@ from fastapi import APIRouter, Depends from fastapi.responses import StreamingResponse from PIL import Image -from ..config import Config, ImageUIConfig -from ..dav_common import webdav_ensure_path -from ..dav_file import DavFile +from ...config import Config, ImageUIConfig +from ...dav_common import webdav_ensure_path +from ...dav_file import DavFile from ._common import FileNameLister, PrefixFinder, PrefixUnique _logger = getLogger(__name__) diff --git a/api/ovdashboard_api/routers/misc.py b/api/ovdashboard_api/routers/v1/misc.py similarity index 93% rename from api/ovdashboard_api/routers/misc.py rename to api/ovdashboard_api/routers/v1/misc.py index a9f2376..cd89130 100644 --- a/api/ovdashboard_api/routers/misc.py +++ b/api/ovdashboard_api/routers/v1/misc.py @@ -11,8 +11,8 @@ from socket import AF_INET, SOCK_DGRAM, socket from fastapi import APIRouter, Depends -from ..config import Config, LogoUIConfig, ServerUIConfig -from ..settings import SETTINGS +from ...config import Config, LogoUIConfig, ServerUIConfig +from ...settings import SETTINGS _logger = getLogger(__name__) diff --git a/api/ovdashboard_api/routers/text.py b/api/ovdashboard_api/routers/v1/text.py similarity index 96% rename from api/ovdashboard_api/routers/text.py rename to api/ovdashboard_api/routers/v1/text.py index efa83de..f841ee3 100644 --- a/api/ovdashboard_api/routers/text.py +++ b/api/ovdashboard_api/routers/v1/text.py @@ -14,8 +14,8 @@ from typing import Iterator from fastapi import APIRouter, Depends from markdown import markdown -from ..dav_common import webdav_ensure_path -from ..dav_file import DavFile +from ...dav_common import webdav_ensure_path +from ...dav_file import DavFile from ._common import FileNameLister, PrefixFinder, PrefixUnique _logger = getLogger(__name__) diff --git a/api/ovdashboard_api/routers/ticker.py b/api/ovdashboard_api/routers/v1/ticker.py similarity index 94% rename from api/ovdashboard_api/routers/ticker.py rename to api/ovdashboard_api/routers/v1/ticker.py index 8eb1530..c70cfef 100644 --- a/api/ovdashboard_api/routers/ticker.py +++ b/api/ovdashboard_api/routers/v1/ticker.py @@ -12,9 +12,9 @@ from typing import Iterator from fastapi import APIRouter, Depends from markdown import markdown -from ..config import Config, TickerUIConfig -from ..dav_common import webdav_ensure_path -from ..dav_file import DavFile +from ...config import Config, TickerUIConfig +from ...dav_common import webdav_ensure_path +from ...dav_file import DavFile from .text import text_lister, text_unique _logger = getLogger(__name__)