Skip to content

Commit

Permalink
fix(storage): exclude auto loading ownerships field from models
Browse files Browse the repository at this point in the history
  • Loading branch information
dantetemplar committed Sep 4, 2023
1 parent 2c2779d commit 11fcded
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/schemas/event_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ViewEventGroup(BaseModel):
name: Optional[str] = None
description: Optional[str] = None
tags: list["ViewTag"] = Field(default_factory=list)
ownerships: list["Ownership"] = Field(default_factory=list)
# ownerships: list["Ownership"] = Field(default_factory=list)

@validator("tags", pre=True, always=True)
def _validate_tags(cls, v):
Expand Down
4 changes: 2 additions & 2 deletions src/schemas/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
from typing import Optional

from pydantic import BaseModel, validator, Json, Field
from pydantic import BaseModel, validator, Json

from src.schemas.ownership import Ownership

Expand All @@ -28,7 +28,7 @@ class ViewTag(BaseModel):
name: Optional[str] = None
satellite: Optional[dict] = None

ownerships: list[Ownership] = Field(default_factory=list)
# ownerships: list[Ownership] = Field(default_factory=list)

@validator("satellite", pre=True, always=True)
def _validate_satellite(cls, v):
Expand Down
2 changes: 1 addition & 1 deletion src/storages/sql/__mixin__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Ownership(Base):

@declared_attr
def ownerships(cls) -> Mapped[list["Ownership"]]:
return relationship(cls.Ownership, lazy="selectin", cascade="all, delete-orphan")
return relationship(cls.Ownership, cascade="all, delete-orphan")

return Mixin

Expand Down

1 comment on commit 11fcded

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src
   exceptions.py35683%11, 28, 42, 56, 84, 98
   main.py884549%82–151, 156–157, 162–165, 175
src/app
   dependencies.py47296%29, 37
src/app/auth
   common.py281739%12–21, 25–32, 36–44, 49–50
   dependencies.py16662%33–38, 42
   jwt.py513433%26–28, 32–36, 40–44, 48–53, 57–70, 74–81
src/app/event_groups
   routes.py723946%39–45, 65–76, 116–120, 140, 186–225
src/app/ics
   routes.py594229%34–43, 49–75, 95–118
src/app/users
   routes.py251348%32–34, 54–59, 78–80, 102–107
src/app/workshops
   __init__.py550%1–9
   routes.py16160%1–63
src/repositories
   crud.py941287%89, 105, 108, 125, 142, 156–157, 171–180
   ownership.py13285%15–16
src/repositories/event_groups
   repository.py58591%57–58, 65–68
src/repositories/predefined
   repository.py1517054%26, 34, 56, 64, 73, 76–84, 97–99, 103–108, 119–123, 127–130, 133, 136, 139, 147–158, 162–171, 175–205
src/repositories/tags
   repository.py761482%55–56, 67–68, 75–76, 81–83, 121–125
src/repositories/workshops
   __init__.py330%1–4
   abc.py440%1–10
   repository.py34340%1–68
src/schemas
   events.py71692%48, 56, 79, 98–100
   ownership.py16194%21
   tags.py39197%36
   workshops.py58580%1–85
TOTAL159443573% 

Tests Skipped Failures Errors Time
53 0 💤 10 ❌ 1 🔥 14.037s ⏱️

Please sign in to comment.