-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Нерабочее состояние, работа в прогрессе
- Loading branch information
1 parent
cf1ef36
commit 2ba21e0
Showing
14 changed files
with
193 additions
and
39 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
.../migrations/versions/2023_11_19_0024-da06417476fd_меняет_в_модели_уровня_name_на_title.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
"""меняет в модели уровня name на title | ||
Revision ID: da06417476fd | ||
Revises: 29ed19cdffbf | ||
Create Date: 2023-11-19 00:24:59.794292 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'da06417476fd' | ||
down_revision: Union[str, None] = '29ed19cdffbf' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('levels', sa.Column('title', sa.String(length=255), nullable=False)) | ||
op.alter_column('levels', 'module_id', | ||
existing_type=sa.UUID(), | ||
nullable=True) | ||
op.drop_column('levels', 'name') | ||
op.alter_column('modules', 'map_id', | ||
existing_type=sa.UUID(), | ||
nullable=True) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column('modules', 'map_id', | ||
existing_type=sa.UUID(), | ||
nullable=False) | ||
op.add_column('levels', sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=False)) | ||
op.alter_column('levels', 'module_id', | ||
existing_type=sa.UUID(), | ||
nullable=False) | ||
op.drop_column('levels', 'title') | ||
# ### end Alembic commands ### |
32 changes: 32 additions & 0 deletions
32
...migrations/versions/2023_11_19_0049-5bbffa09568b_меняет_в_модели_теории_theme_на_title.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""меняет в модели теории theme на title | ||
Revision ID: 5bbffa09568b | ||
Revises: da06417476fd | ||
Create Date: 2023-11-19 00:49:49.197801 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '5bbffa09568b' | ||
down_revision: Union[str, None] = 'da06417476fd' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('theory_blocks', sa.Column('title', sa.String(), nullable=False)) | ||
op.drop_column('theory_blocks', 'theme') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('theory_blocks', sa.Column('theme', sa.VARCHAR(), autoincrement=False, nullable=False)) | ||
op.drop_column('theory_blocks', 'title') | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .models import TaskUnit, TaskTypes, TaskStates, EmployeesTask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from game.levels import Level | ||
from repository.sqlalchemy_repository import SQLAlchemyRepository | ||
|
||
|
||
class LevelRepository(SQLAlchemyRepository): | ||
model = Level |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import uuid | ||
|
||
from game.levels.schemas import LevelRead, LevelCreate, LevelUpdate | ||
from repository.abstract import AbstractRepository | ||
|
||
|
||
class LevelService: | ||
__level_repo: AbstractRepository | ||
|
||
def __init__(self, level_repo: type[AbstractRepository]): | ||
self.__level_repo = level_repo() | ||
|
||
async def create_one(self, level_create: LevelCreate) -> LevelRead: | ||
level_dict = level_create.model_dump() | ||
return await self.__level_repo.add_one(level_dict) | ||
|
||
async def get_all(self) -> list[LevelRead]: | ||
models = await self.__level_repo.find_all() | ||
return [model.to_read_schema() for model in models] | ||
|
||
async def get_one(self, id: uuid.UUID) -> LevelRead: | ||
res = await self.__level_repo.get_one(id) | ||
return res.to_read_schema() | ||
|
||
async def delete_one(self, id: uuid.UUID) -> LevelRead: | ||
res = await self.__level_repo.delete_one(id) | ||
return res.to_read_schema() | ||
|
||
async def update_one(self, id: uuid.UUID, level_update: LevelUpdate) -> LevelRead: | ||
level_dict = level_update.model_dump() | ||
res = await self.__level_repo.update_one(id, level_dict) | ||
return res.to_read_schema() |
Oops, something went wrong.