fix: ruff format
This commit is contained in:
		@@ -80,7 +80,6 @@ async def get_user_by_login(connection: AsyncConnection, login: str) -> Optional
 | 
			
		||||
    if not user_data:
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return User.model_validate(user_data)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -122,9 +122,6 @@ async def get_listevents_by_name(connection: AsyncConnection, name: str) -> Opti
 | 
			
		||||
    if not listevents_data:
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return ListEvent.model_validate(listevents_data)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -13,6 +13,7 @@ from api.schemas.process.process_schema import ProcessSchema
 | 
			
		||||
 | 
			
		||||
from api.schemas.endpoints.process_schema import all_process_schema_adapter, AllProcessSchemaResponse
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def get_process_schema_page_by_creator_id(
 | 
			
		||||
    connection: AsyncConnection, creator_id: int, page: int, limit: int
 | 
			
		||||
) -> Optional[AllProcessSchemaResponse]:
 | 
			
		||||
@@ -39,9 +40,7 @@ async def get_process_schema_page_by_creator_id(
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    count_query = (
 | 
			
		||||
        select(func.count())
 | 
			
		||||
        .select_from(process_schema_table)
 | 
			
		||||
        .where(process_schema_table.c.creator_id == creator_id)
 | 
			
		||||
        select(func.count()).select_from(process_schema_table).where(process_schema_table.c.creator_id == creator_id)
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    result = await connection.execute(query)
 | 
			
		||||
@@ -94,7 +93,6 @@ async def get_process_schema_page(connection: AsyncConnection, page, limit) -> O
 | 
			
		||||
    total_count = count_result.scalar()
 | 
			
		||||
    total_pages = math.ceil(total_count / limit)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    validated_process_schema = all_process_schema_adapter.validate_python(events_data)
 | 
			
		||||
 | 
			
		||||
    return AllProcessSchemaResponse(
 | 
			
		||||
@@ -106,7 +104,6 @@ async def get_process_schema_page(connection: AsyncConnection, page, limit) -> O
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def get_process_schema_by_title(connection: AsyncConnection, title: str) -> Optional[ProcessSchema]:
 | 
			
		||||
    """
 | 
			
		||||
    Получает process schema  по title.
 | 
			
		||||
@@ -121,6 +118,7 @@ async def get_process_schema_by_title(connection: AsyncConnection, title: str) -
 | 
			
		||||
 | 
			
		||||
    return ProcessSchema.model_validate(processschema_data)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def get_process_schema_by_id(connection: AsyncConnection, id: int) -> Optional[ProcessSchema]:
 | 
			
		||||
    """
 | 
			
		||||
    Получает processschema по id.
 | 
			
		||||
@@ -129,13 +127,13 @@ async def get_process_schema_by_id(connection: AsyncConnection, id: int) -> Opti
 | 
			
		||||
 | 
			
		||||
    processschema_db_cursor = await connection.execute(query)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    processschema_data = processschema_db_cursor.mappings().one_or_none()
 | 
			
		||||
    if not processschema_data:
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
    return ProcessSchema.model_validate(processschema_data)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def update_process_schema_by_id(connection: AsyncConnection, update_values, processschema):
 | 
			
		||||
    """
 | 
			
		||||
    Вносит изменеия в нужное поле таблицы process_schema_table.
 | 
			
		||||
@@ -146,7 +144,10 @@ async def update_process_schema_by_id(connection: AsyncConnection, update_values
 | 
			
		||||
 | 
			
		||||
    await connection.commit()
 | 
			
		||||
 | 
			
		||||
async def create_process_schema(connection: AsyncConnection, processschema: ProcessSchema, creator_id: int) -> Optional[ProcessSchema]:
 | 
			
		||||
 | 
			
		||||
async def create_process_schema(
 | 
			
		||||
    connection: AsyncConnection, processschema: ProcessSchema, creator_id: int
 | 
			
		||||
) -> Optional[ProcessSchema]:
 | 
			
		||||
    """
 | 
			
		||||
    Создает нове поле в таблице process_schema_table.
 | 
			
		||||
    """
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ from api.endpoints.keyring import api_router as keyring_router
 | 
			
		||||
from api.endpoints.listevents import api_router as listevents_router
 | 
			
		||||
from api.endpoints.processschema import api_router as processschema_router
 | 
			
		||||
 | 
			
		||||
list_of_routes = [auth_router, profile_router, account_router, keyring_router, listevents_router,processschema_router]
 | 
			
		||||
list_of_routes = [auth_router, profile_router, account_router, keyring_router, listevents_router, processschema_router]
 | 
			
		||||
 | 
			
		||||
__all__ = [
 | 
			
		||||
    "list_of_routes",
 | 
			
		||||
 
 | 
			
		||||
@@ -98,7 +98,6 @@ async def update_account(
 | 
			
		||||
    if user_update.password is not None:
 | 
			
		||||
        await update_password_key(connection, user.id, user_update.password)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    updated_values = user_update.model_dump(by_alias=True, exclude_none=True)
 | 
			
		||||
 | 
			
		||||
    if not updated_values:
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ from api.db.logic.processschema import (
 | 
			
		||||
    get_process_schema_by_id,
 | 
			
		||||
    update_process_schema_by_id,
 | 
			
		||||
    get_process_schema_page_by_creator_id,
 | 
			
		||||
    get_process_schema_page
 | 
			
		||||
    get_process_schema_page,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
from api.schemas.process.process_schema import ProcessSchema
 | 
			
		||||
@@ -42,6 +42,7 @@ api_router = APIRouter(
 | 
			
		||||
    tags=["process schema"],
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@api_router.get("", dependencies=[Depends(bearer_schema)], response_model=AllProcessSchemaResponse)
 | 
			
		||||
async def get_all_process_schema(
 | 
			
		||||
    page: int = 1,
 | 
			
		||||
@@ -87,6 +88,7 @@ async def get_process_schema(
 | 
			
		||||
 | 
			
		||||
    return processschema_validation
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@api_router.post("", dependencies=[Depends(bearer_schema)], response_model=ProcessSchema)
 | 
			
		||||
async def create_processschema(
 | 
			
		||||
    processschema: ProcessSchemaUpdate,
 | 
			
		||||
@@ -134,6 +136,7 @@ async def update_process_schema(
 | 
			
		||||
 | 
			
		||||
    return processschema
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@api_router.delete("/{processschema_id}", dependencies=[Depends(bearer_schema)], response_model=ProcessSchema)
 | 
			
		||||
async def delete_process_schema(
 | 
			
		||||
    processschema_id: int,
 | 
			
		||||
 
 | 
			
		||||
@@ -47,7 +47,6 @@ async def update_profile(
 | 
			
		||||
        raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Account not found")
 | 
			
		||||
 | 
			
		||||
    if user_update.role is None and user_update.login is None:
 | 
			
		||||
 | 
			
		||||
        updated_values = user_update.model_dump(by_alias=True, exclude_none=True)
 | 
			
		||||
 | 
			
		||||
        if updated_values is None:
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,7 @@ class ProcessSchemaUpdate(Base):
 | 
			
		||||
    settings: Optional[Dict[str, Any]] = None
 | 
			
		||||
    status: Optional[ProcessStatus] = None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AllProcessSchema(Base):
 | 
			
		||||
    id: int
 | 
			
		||||
    title: str = Field(..., max_length=100)
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ from datetime import datetime
 | 
			
		||||
from api.schemas.base import Base
 | 
			
		||||
from api.db.tables.process import ProcessStatus
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ProcessSchema(Base):
 | 
			
		||||
    id: int
 | 
			
		||||
    title: str = Field(..., max_length=100)
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,8 @@ from datetime import datetime
 | 
			
		||||
from typing import Dict, Any
 | 
			
		||||
 | 
			
		||||
from api.schemas.base import Base
 | 
			
		||||
from api.db.tables.process import NodeType,NodeStatus
 | 
			
		||||
from api.db.tables.process import NodeType, NodeStatus
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Ps_Node(Base):
 | 
			
		||||
    id: int
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@ from api.db.tables.events import EventState, EventStatus
 | 
			
		||||
from api.schemas.endpoints.process_schema import ProcessSchemaUpdate
 | 
			
		||||
from api.db.tables.process import ProcessStatus
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def update_user_data_changes(update_data: UserUpdate, user) -> Optional[dict]:
 | 
			
		||||
    """
 | 
			
		||||
    Сравнивает данные для обновления с текущими значениями пользователя.
 | 
			
		||||
@@ -110,6 +111,7 @@ def update_listevents_data_changes(update_data: ListEventUpdate, listevents) ->
 | 
			
		||||
 | 
			
		||||
    return changes if changes else None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def update_processschema_data_changes(update_data: ProcessSchemaUpdate, processschema) -> Optional[dict]:
 | 
			
		||||
    """
 | 
			
		||||
    Сравнивает данные для обновления с текущими значениями processschema.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user