Add base for route
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from datetime import timedelta
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sqlmodel import (
|
||||
@@ -16,10 +17,11 @@ from .base import (
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .event import Event
|
||||
from .route import Route
|
||||
|
||||
# region # Hike ################################################################
|
||||
|
||||
|
||||
class HikeTeamPage(DocumentedIntFlag):
|
||||
ROUTE = auto_enum() # Route steps info
|
||||
QUESTIONS = auto_enum() # Visible questions
|
||||
@@ -101,7 +103,7 @@ class HikeBase(
|
||||
|
||||
max_time_points: int | None = Field(
|
||||
default=100,
|
||||
ge=0, # TODO: ge > min_time_points
|
||||
ge=0, # TODO: ge > min_time_points
|
||||
description="Max points for time",
|
||||
)
|
||||
|
||||
@@ -129,6 +131,7 @@ class Hike(mixin.RowId, HikeBase, table=True):
|
||||
# --- read only items ------------------------------------------------------
|
||||
|
||||
# --- back_populates links -------------------------------------------------
|
||||
routes: list["Route"] = Relationship(back_populates="hike", cascade_delete=True)
|
||||
|
||||
# --- CRUD actions ---------------------------------------------------------
|
||||
@classmethod
|
||||
@@ -164,18 +167,3 @@ class HikesPublic(BaseSQLModel):
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
|
||||
# region # Hike / Route ########################################################
|
||||
|
||||
|
||||
class RouteType(DocumentedStrEnum):
|
||||
START_FINISH = auto_enum() # Start at the start and end at the finish
|
||||
CIRCULAR = auto_enum() # Start some ware, finish at the last new place
|
||||
CIRCULAR_BACK_TO_START = auto_enum() # Start and finish on the same random place (CIRCULAR + next to start)
|
||||
|
||||
|
||||
# ##############################################################################
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
Reference in New Issue
Block a user