Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
gitfresnel committed Oct 23, 2024
1 parent 2115821 commit 2a6326b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
Create Date: 2024-10-19 19:49:20.361627
"""
from alembic import op

import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
Expand All @@ -18,9 +19,7 @@

def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('file', 'source',
existing_type=sa.VARCHAR(),
nullable=False)
op.alter_column('file', 'source', existing_type=sa.VARCHAR(), nullable=False)
op.add_column('union_member', sa.Column('is_deleted', sa.Boolean(), nullable=True))
op.execute(f'UPDATE "union_member" SET is_deleted = False')
op.alter_column('union_member', sa.Column('is_deleted', sa.Boolean(), nullable=False))
Expand All @@ -31,7 +30,5 @@ def upgrade():
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('union_member', 'is_deleted')
op.alter_column('file', 'source',
existing_type=sa.VARCHAR(),
nullable=True)
op.alter_column('file', 'source', existing_type=sa.VARCHAR(), nullable=True)
# ### end Alembic commands ###
4 changes: 2 additions & 2 deletions print_service/routes/exc_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
TooManyPages,
UnionStudentDuplicate,
UnprocessableFileInstance,
UserNotFound,
UserIsDeleted,
UserNotFound,
)
from print_service.routes.base import app
from print_service.settings import get_settings
Expand Down Expand Up @@ -82,7 +82,7 @@ async def user_is_deleted(req: starlette.requests.Request, exc: TerminalTokenNot
content=StatusResponseModel(
status="Error", message="User is deleted", ru="Пользователь удалён из базы"
).model_dump(),
status_code=410
status_code=410,
)


Expand Down
2 changes: 1 addition & 1 deletion print_service/routes/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
TooLargeSize,
TooManyPages,
UnprocessableFileInstance,
UserNotFound,
UserIsDeleted,
UserNotFound,
)
from print_service.models import File as FileModel
from print_service.models import UnionMember
Expand Down
7 changes: 2 additions & 5 deletions print_service/routes/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sqlalchemy import and_, func, or_

from print_service import __version__
from print_service.exceptions import UnionStudentDuplicate, UserNotFound, UserIsDeleted
from print_service.exceptions import UnionStudentDuplicate, UserIsDeleted, UserNotFound
from print_service.models import UnionMember
from print_service.schema import BaseModel
from print_service.settings import get_settings
Expand Down Expand Up @@ -40,10 +40,7 @@ class UpdateUserList(BaseModel):
@router.get(
'/is_union_member',
status_code=202,
responses={
404: {'detail': 'User not found'},
410: {'detail': 'User is deleted'}
},
responses={404: {'detail': 'User not found'}, 410: {'detail': 'User is deleted'}},
)
async def check_union_member(
surname: constr(strip_whitespace=True, to_upper=True, min_length=1),
Expand Down
8 changes: 1 addition & 7 deletions tests/test_routes/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,7 @@ def test_upload_is_deleted(pin_pdf, client, add_is_deleted_flag):

def test_patch_is_deleted(pin_pdf, client, add_is_deleted_flag):
pin = pin_pdf
body = {
"options": {
"pages": "",
"copies": 2,
"two_sided": False
}
}
body = {"options": {"pages": "", "copies": 2, "two_sided": False}}
res = client.patch(f"{url}/{pin}", json=body)
assert res.status_code == status.HTTP_410_GONE

Expand Down
1 change: 0 additions & 1 deletion tests/test_routes/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,3 @@ def test_post_list_duplicates(users, client):
body = {'users': users}
res = client.post(url, json=body)
assert res.status_code == status.HTTP_400_BAD_REQUEST, res.json()

0 comments on commit 2a6326b

Please sign in to comment.