Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from rental_backend.models.base import BaseDbModel
from rental_backend.settings import get_settings


# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
Expand Down
1 change: 0 additions & 1 deletion migrations/versions/498e4ee72e00_add_session_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sqlalchemy as sa
from alembic import op


revision = '498e4ee72e00'
down_revision = 'c00918b76464'
branch_labels = None
Expand Down
1 change: 0 additions & 1 deletion migrations/versions/5703d0209eba_softdeletes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision = '5703d0209eba'
down_revision = 'f51216ed6c1f'
Expand Down
1 change: 0 additions & 1 deletion migrations/versions/c00918b76464_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sqlalchemy as sa
from alembic import op


revision = 'c00918b76464'
down_revision = None
branch_labels = None
Expand Down
1 change: 0 additions & 1 deletion migrations/versions/f51216ed6c1f_add_fullname.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision = 'f51216ed6c1f'
down_revision = 'fb8a57b65c4d'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sqlalchemy as sa
from alembic import op


revision = 'fb8a57b65c4d'
down_revision = 'fccbec47bef3'
branch_labels = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sqlalchemy as sa
from alembic import op


revision = 'fccbec47bef3'
down_revision = '498e4ee72e00'
branch_labels = None
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ skip-string-normalization = true
line_length = 120
multi_line_output = 3
profile = "black"
lines_after_imports = 2
lines_after_imports = 1
include_trailing_comma = true

[tool.pytest.ini_options]
Expand Down
1 change: 0 additions & 1 deletion rental_backend/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os


__version__ = os.getenv("APP_VERSION", "dev")
1 change: 0 additions & 1 deletion rental_backend/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

from rental_backend.routes.base import app


if __name__ == '__main__':
uvicorn.run(app)
1 change: 0 additions & 1 deletion rental_backend/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .base import Base, BaseDbModel
from .db import *


__all__ = ["Base", "BaseDbModel", "Item", "ItemType", "RentalSession", "Event", "Strike"]
1 change: 0 additions & 1 deletion rental_backend/models/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

from .base import BaseDbModel


settings: Settings = get_settings()


Expand Down
1 change: 0 additions & 1 deletion rental_backend/routes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from . import exc_handlers
from .base import app


__all__ = ["app", "exc_handlers"]
1 change: 0 additions & 1 deletion rental_backend/routes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from rental_backend.routes.strike import strike
from rental_backend.settings import get_settings


settings = get_settings()
app = FastAPI(
title='Сервис цифрового проката',
Expand Down
1 change: 0 additions & 1 deletion rental_backend/routes/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from rental_backend.models.db import Event
from rental_backend.schemas.models import EventGet


event = APIRouter(prefix="/event", tags=["Event"])


Expand Down
4 changes: 2 additions & 2 deletions rental_backend/routes/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from rental_backend.settings import Settings, get_settings
from rental_backend.utils.action import ActionLogger


settings: Settings = get_settings()
item = APIRouter(prefix="/item", tags=["Items"])

Expand Down Expand Up @@ -113,7 +112,8 @@ async def delete_item(
raise ObjectNotFound(Item, id)
Item.delete(id, session=db.session)
for rental_session in rental_sessions:
RentalSession.delete(rental_session.id, session=db.session)
if not rental_session.is_deleted:
RentalSession.delete(rental_session.id, session=db.session)
strikes = db.session.query(Strike).filter(Strike.session_id == rental_session.id)
for strike in strikes:
Strike.delete(strike.id, session=db.session)
Expand Down
1 change: 0 additions & 1 deletion rental_backend/routes/item_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from rental_backend.settings import Settings, get_settings
from rental_backend.utils.action import ActionLogger


settings: Settings = get_settings()
item_type = APIRouter(prefix="/itemtype", tags=["ItemType"])

Expand Down
1 change: 0 additions & 1 deletion rental_backend/routes/rental_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from rental_backend.settings import Settings, get_settings
from rental_backend.utils.action import ActionLogger


settings: Settings = get_settings()
rental_session = APIRouter(prefix="/rental-sessions", tags=["RentalSession"])

Expand Down
1 change: 0 additions & 1 deletion rental_backend/routes/strike.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from rental_backend.schemas.models import StrikeGet, StrikePost
from rental_backend.utils.action import ActionLogger


strike = APIRouter(prefix="/strike", tags=["Strike"])


Expand Down
1 change: 0 additions & 1 deletion tests/test_routes/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from rental_backend.models import Item
from rental_backend.settings import get_settings


logger = logging.getLogger(__name__)
url: str = '/item'

Expand Down
1 change: 0 additions & 1 deletion tests/test_routes/test_item_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from rental_backend.settings import get_settings


logger = logging.getLogger(__name__)
url: str = '/itemtype'

Expand Down
1 change: 0 additions & 1 deletion tests/test_routes/test_rental_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from rental_backend.schemas.models import RentStatus
from tests.conftest import model_to_dict


obj_prefix: str = rental_session.prefix


Expand Down
Loading