Remove some copy problems
This commit is contained in:
@@ -256,7 +256,7 @@ def read_event_teams(
|
|||||||
module=PermissionModule.EVENT,
|
module=PermissionModule.EVENT,
|
||||||
part=PermissionPart.ADMIN,
|
part=PermissionPart.ADMIN,
|
||||||
rights=(PermissionRight.READ | PermissionRight.MANGE_TEAMS),
|
rights=(PermissionRight.READ | PermissionRight.MANGE_TEAMS),
|
||||||
) and ( event and (event.user_has_right(user=current_user, rights=(PermissionRight.READ | PermissionRight.MANGE_TEAMS)))):
|
) and ( event and (event.user_has_rights(user=current_user, rights=(PermissionRight.READ | PermissionRight.MANGE_TEAMS)))):
|
||||||
raise HTTPException(status_code=400, detail="Not enough permissions")
|
raise HTTPException(status_code=400, detail="Not enough permissions")
|
||||||
|
|
||||||
# Get list
|
# Get list
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ from app.models.user import (
|
|||||||
User,
|
User,
|
||||||
UserCreate,
|
UserCreate,
|
||||||
)
|
)
|
||||||
|
from app.models.apikey import (
|
||||||
|
ApiKey,
|
||||||
|
)
|
||||||
|
|
||||||
engine = create_engine(str(settings.SQLALCHEMY_DATABASE_URI))
|
engine = create_engine(str(settings.SQLALCHEMY_DATABASE_URI))
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import random
|
import random
|
||||||
|
from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from sqlmodel import Field, Relationship, Session, select
|
from sqlmodel import Field, Relationship, Session, select
|
||||||
|
|
||||||
@@ -7,7 +8,9 @@ from .base import (
|
|||||||
BaseSQLModel,
|
BaseSQLModel,
|
||||||
RowId,
|
RowId,
|
||||||
)
|
)
|
||||||
from .user import User
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .user import User
|
||||||
|
|
||||||
# region # API Keys for access ###################################################
|
# region # API Keys for access ###################################################
|
||||||
|
|
||||||
@@ -39,7 +42,7 @@ class ApiKey(mixin.RowId, ApiKeyBase, table=True):
|
|||||||
api_key: str = Field(unique=True, nullable=False, max_length=64)
|
api_key: str = Field(unique=True, nullable=False, max_length=64)
|
||||||
|
|
||||||
# --- back_populates links -------------------------------------------------
|
# --- back_populates links -------------------------------------------------
|
||||||
user: User | None = Relationship(back_populates="api_keys")
|
user: "User" = Relationship(back_populates="api_keys")
|
||||||
|
|
||||||
# --- CRUD actions ---------------------------------------------------------
|
# --- CRUD actions ---------------------------------------------------------
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ class EventBase(
|
|||||||
mixin.Contact,
|
mixin.Contact,
|
||||||
mixin.StartEndDate,
|
mixin.StartEndDate,
|
||||||
mixin.IsActive,
|
mixin.IsActive,
|
||||||
mixin.Contact,
|
|
||||||
BaseSQLModel,
|
BaseSQLModel,
|
||||||
):
|
):
|
||||||
pass
|
pass
|
||||||
@@ -72,7 +71,8 @@ class Event(mixin.RowId, EventBase, table=True):
|
|||||||
# --- back_populates links -------------------------------------------------
|
# --- back_populates links -------------------------------------------------
|
||||||
|
|
||||||
# --- many-to-many links ---------------------------------------------------
|
# --- many-to-many links ---------------------------------------------------
|
||||||
user_links: list[EventUserLink] = Relationship(back_populates="event")
|
user_links: list["EventUserLink"] = Relationship(back_populates="event")
|
||||||
|
team_links: list["EventTeam"] = Relationship(back_populates="event")
|
||||||
|
|
||||||
# --- CRUD actions ---------------------------------------------------------
|
# --- CRUD actions ---------------------------------------------------------
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -189,7 +189,7 @@ class EventTeam(mixin.RowId, EventTeamBase, table=True):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# --- back_populates links -------------------------------------------------
|
# --- back_populates links -------------------------------------------------
|
||||||
event: "Event" = Relationship(back_populates="team_links", cascade_delete=True)
|
event: "Event" = Relationship(back_populates="team_links")#, cascade_delete=True)
|
||||||
# team: "ScoutingTeam" = Relationship(back_populates="event_links", cascade_delete=True)
|
# team: "ScoutingTeam" = Relationship(back_populates="event_links", cascade_delete=True)
|
||||||
|
|
||||||
# --- CRUD actions ---------------------------------------------------------
|
# --- CRUD actions ---------------------------------------------------------
|
||||||
|
|||||||
@@ -91,3 +91,8 @@ class Canceled(BaseModel):
|
|||||||
canceled_reason: str | None = Field(default=None, nullable=True, max_length=1024)
|
canceled_reason: str | None = Field(default=None, nullable=True, max_length=1024)
|
||||||
|
|
||||||
|
|
||||||
|
class CheckInCheckOut(BaseModel):
|
||||||
|
checkin_at: datetime | None = Field(default=None, nullable=True)
|
||||||
|
checkout_at: datetime | None = Field(default=None, nullable=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user