- Switched from psycopg2 to asyncpg for async SQLAlchemy support - Fixed router registration in main.py - removed duplicate prefixes - Added user_data export to routers/__init__.py - Refactored decks router to use DeckManager service layer - Integrated FuzzyCardMatcher into card_router search endpoints - Made WishlistCreate.card_id optional for proper schema validation - Set PostgreSQL password and configured scram-sha-256 auth - Updated alembic.ini to use local PostgreSQL instead of Docker hostname - Created generic_schemas.py for reusable schema patterns - Added test_routers.py and test_schema_validation.py test files - All 6 Alembic migrations applied successfully (37 tables created) - Application running on port 8000 with all services connected
148 lines
7.4 KiB
Python
148 lines
7.4 KiB
Python
"""Schemas package initialization."""
|
|
from app.schemas.schemas import (
|
|
LoginRequest, LoginResponse, RefreshTokenRequest, TokenResponse,
|
|
UserBase, UserCreate, UserUpdate, UserResponse,
|
|
DeckCreate, DeckUpdate, DeckResponse,
|
|
FolderCreate, FolderResponse,
|
|
GameCreate, GameResponse,
|
|
RoomResponse,
|
|
BanCreate, BanResponse,
|
|
ErrorResponse, ValidationErrorResponse,
|
|
PaginationParams, PaginatedResponse,
|
|
CardMirrorResponse, DeckCardLinkResponse, DeckWithCardsResponse,
|
|
)
|
|
from app.schemas.user_data_schemas import (
|
|
DeckVersionStatus, GameReplayStatus, GameOutcomeType,
|
|
GroupMemberRole, NetworkMemberRole, UserPreferenceTheme, ActivityType,
|
|
SessionResponse, SessionCleanupResponse,
|
|
DeckVersionCreate, DeckVersionUpdate, DeckVersionResponse, DeckVersionListResponse,
|
|
GameReplayCreate, GameReplayUpdate, GameReplayResponse, GameReplayListResponse,
|
|
GameOutcomeCreate, GameOutcomeResponse, GameOutcomeListResponse,
|
|
UserStatisticsResponse, StatisticsUpdateResponse,
|
|
GroupCreate, GroupUpdate, GroupMemberCreate, GroupMemberUpdate, GroupMemberRemove,
|
|
GroupResponse, GroupListResponse, GroupChatMessageCreate, GroupChatMessageResponse, GroupChatMessageListResponse,
|
|
NetworkCreate, NetworkUpdate, NetworkMemberCreate,
|
|
NetworkResponse, NetworkListResponse,
|
|
UserPreferenceUpdate, UserPreferenceResponse,
|
|
ActivityLogEntry, ActivityLogListResponse,
|
|
MessageResponse, CountResponse, ErrorDetail,
|
|
)
|
|
from app.schemas.user_card_collection import (
|
|
CardCondition, AcquisitionMethod,
|
|
CardCollectionCreate, CardCollectionUpdate, CardCollectionResponse, CardCollectionListResponse,
|
|
WishlistCreate, WishlistUpdate, WishlistResponse, WishlistListResponse,
|
|
CollectionStatistics, CollectionSummaryResponse,
|
|
)
|
|
from app.schemas.user_deck_schemas import (
|
|
DeckStatus, DeckZone, SuggestionType,
|
|
UserDeckCreate, UserDeckUpdate, UserDeckResponse, UserDeckListResponse,
|
|
DeckCardCreate, DeckCardUpdate, DeckCardResponse, DeckCardWithDetailsResponse, DeckCardListResponse,
|
|
PrecedentCreate, PrecedentUpdate, PrecedentResponse, PrecedentListResponse,
|
|
SuggestionCreate, SuggestionResponse, SuggestionListResponse,
|
|
DeckFinalizeRequest, DeckFinalizeResponse, DeckDeleteResponse,
|
|
CardSearchRequest,
|
|
)
|
|
from app.schemas.card_import_schemas import (
|
|
CardImportRequest, CardImportResponse as CardImportResponseV2, CardImportStatusResponse as CardImportStatusResponseV2,
|
|
CardMatchResult as CardMatchResultV2, CardImportSummary as CardImportSummaryV2,
|
|
CardImportBatchCreate, CardImportBatchResponse,
|
|
UserCardImportCreate, UserCardImportResponse, UserCardImportRecordResponse,
|
|
)
|
|
from app.schemas.card_search_schemas import (
|
|
CardResponse, SetResponse, CardTypeResponse,
|
|
CardSearchResponse as CardSearchResponseV2,
|
|
CardImportResponse as CardImportResponseV3,
|
|
CardImportStatusResponse as CardImportStatusResponseV3,
|
|
CardMatchResult as CardMatchResultV3,
|
|
CardImportSummary as CardImportSummaryV3,
|
|
)
|
|
from app.schemas.game_schemas import (
|
|
GameCreate as GameCreateV2, GameResponse as GameResponseV2, GameJoinRequest, GameLeaveRequest,
|
|
GameListResponse, GamePlayerResponse, GameStateResponse,
|
|
)
|
|
from app.schemas.mtg_card_schemas import (
|
|
MtgCardResponse, MtgCardSearchRequest, MtgCardSearchResponse,
|
|
MtgSetResponse, MtgCardMirrorResponse,
|
|
DeckCardLinkResponse as DeckCardLinkResponseV2, DeckWithCardsResponse as DeckWithCardsResponseV2,
|
|
)
|
|
from app.schemas.proto_messages import (
|
|
ProtoMessageBase, SessionCommand, GameCommand, GameEvent, Response,
|
|
ServerInfoUser, ServerInfoDeckStorageFile, ServerInfoDeckStorageFolder,
|
|
ServerInfoDeckStorageTreeItem, ServerInfoCard, ServerInfoZone, ServerInfoGame,
|
|
)
|
|
from app.schemas.protocol_constants import (
|
|
SessionCommandType, GameCommandType, GameEventType, ResponseCode,
|
|
ZoneType, UserLevelFlag,
|
|
)
|
|
|
|
__all__ = [
|
|
# Auth
|
|
"LoginRequest", "LoginResponse", "RefreshTokenRequest", "TokenResponse",
|
|
# User
|
|
"UserBase", "UserCreate", "UserUpdate", "UserResponse",
|
|
# Deck
|
|
"DeckCreate", "DeckUpdate", "DeckResponse",
|
|
"FolderCreate", "FolderResponse",
|
|
# Game
|
|
"GameCreate", "GameResponse", "RoomResponse",
|
|
"GameJoinRequest", "GameLeaveRequest", "GameListResponse", "GamePlayerResponse", "GameStateResponse",
|
|
# Ban
|
|
"BanCreate", "BanResponse",
|
|
# Error
|
|
"ErrorResponse", "ValidationErrorResponse",
|
|
# Pagination
|
|
"PaginationParams", "PaginatedResponse",
|
|
# Card Mirror
|
|
"CardMirrorResponse", "DeckCardLinkResponse", "DeckWithCardsResponse",
|
|
# User Data
|
|
"DeckVersionStatus", "GameReplayStatus", "GameOutcomeType",
|
|
"GroupMemberRole", "NetworkMemberRole", "UserPreferenceTheme", "ActivityType",
|
|
"SessionResponse", "SessionCleanupResponse",
|
|
"DeckVersionCreate", "DeckVersionUpdate", "DeckVersionResponse", "DeckVersionListResponse",
|
|
"GameReplayCreate", "GameReplayUpdate", "GameReplayResponse", "GameReplayListResponse",
|
|
"GameOutcomeCreate", "GameOutcomeResponse", "GameOutcomeListResponse",
|
|
"UserStatisticsResponse", "StatisticsUpdateResponse",
|
|
"GroupCreate", "GroupUpdate", "GroupMemberCreate", "GroupMemberUpdate", "GroupMemberRemove",
|
|
"GroupResponse", "GroupListResponse", "GroupChatMessageCreate", "GroupChatMessageResponse", "GroupChatMessageListResponse",
|
|
"NetworkCreate", "NetworkUpdate", "NetworkMemberCreate",
|
|
"NetworkResponse", "NetworkListResponse",
|
|
"UserPreferenceUpdate", "UserPreferenceResponse",
|
|
"ActivityLogEntry", "ActivityLogListResponse",
|
|
"MessageResponse", "CountResponse", "ErrorDetail",
|
|
# Card Collection
|
|
"CardCondition", "AcquisitionMethod",
|
|
"CardCollectionCreate", "CardCollectionUpdate", "CardCollectionResponse", "CardCollectionListResponse",
|
|
"WishlistCreate", "WishlistUpdate", "WishlistResponse", "WishlistListResponse",
|
|
"CollectionStatistics", "CollectionSummaryResponse",
|
|
# User Deck
|
|
"DeckStatus", "DeckZone", "SuggestionType",
|
|
"UserDeckCreate", "UserDeckUpdate", "UserDeckResponse", "UserDeckListResponse",
|
|
"DeckCardCreate", "DeckCardUpdate", "DeckCardResponse", "DeckCardWithDetailsResponse", "DeckCardListResponse",
|
|
"PrecedentCreate", "PrecedentUpdate", "PrecedentResponse", "PrecedentListResponse",
|
|
"SuggestionCreate", "SuggestionResponse", "SuggestionListResponse",
|
|
"DeckFinalizeRequest", "DeckFinalizeResponse", "DeckDeleteResponse",
|
|
"CardSearchRequest", "CardSearchResponse",
|
|
# Card Import
|
|
"CardImportRequest", "CardImportResponseV2", "CardImportStatusResponseV2",
|
|
"CardMatchResultV2", "CardImportSummaryV2",
|
|
"CardImportBatchCreate", "CardImportBatchResponse",
|
|
"UserCardImportCreate", "UserCardImportResponse", "UserCardImportRecordResponse",
|
|
# Card Search
|
|
"CardResponse", "SetResponse", "CardTypeResponse",
|
|
"CardSearchResponseV2", "CardImportResponseV3", "CardImportStatusResponseV3",
|
|
"CardMatchResultV3", "CardImportSummaryV3",
|
|
# Game Schemas
|
|
"GameCreateV2", "GameResponseV2",
|
|
# MTG Card Schemas
|
|
"MtgCardResponse", "MtgCardSearchRequest", "MtgCardSearchResponse",
|
|
"MtgSetResponse", "MtgCardMirrorResponse",
|
|
"DeckCardLinkResponseV2", "DeckWithCardsResponseV2",
|
|
# Proto Messages
|
|
"ProtoMessageBase", "SessionCommand", "GameCommand", "GameEvent", "Response",
|
|
"ServerInfoUser", "ServerInfoDeckStorageFile", "ServerInfoDeckStorageFolder",
|
|
"ServerInfoDeckStorageTreeItem", "ServerInfoCard", "ServerInfoZone", "ServerInfoGame",
|
|
# Protocol Constants
|
|
"SessionCommandType", "GameCommandType", "GameEventType", "ResponseCode",
|
|
"ZoneType", "UserLevelFlag",
|
|
]
|