aiteamutils 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aiteamutils/__init__.py +3 -4
- aiteamutils/base_repository.py +6 -5
- aiteamutils/base_service.py +2 -2
- aiteamutils/database.py +30 -30
- aiteamutils/validators.py +7 -4
- aiteamutils/version.py +2 -0
- {aiteamutils-0.2.2.dist-info → aiteamutils-0.2.4.dist-info}/METADATA +12 -6
- aiteamutils-0.2.4.dist-info/RECORD +16 -0
- aiteamutils-0.2.2.dist-info/RECORD +0 -15
- {aiteamutils-0.2.2.dist-info → aiteamutils-0.2.4.dist-info}/WHEEL +0 -0
    
        aiteamutils/__init__.py
    CHANGED
    
    | @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            from .base_model import Base
         | 
| 2 | 
            -
            from .database import  | 
| 2 | 
            +
            from .database import DatabaseService
         | 
| 3 3 | 
             
            from .exceptions import (
         | 
| 4 4 | 
             
                CustomException,
         | 
| 5 5 | 
             
                ErrorCode,
         | 
| @@ -21,8 +21,7 @@ from .base_repository import BaseRepository | |
| 21 21 | 
             
            from .validators import validate_with
         | 
| 22 22 | 
             
            from .enums import ActivityType
         | 
| 23 23 | 
             
            from .cache import CacheManager
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            __version__ = "0.1.0"
         | 
| 24 | 
            +
            from .version import __version__
         | 
| 26 25 |  | 
| 27 26 | 
             
            __all__ = [
         | 
| 28 27 | 
             
                # Base Models
         | 
| @@ -31,7 +30,7 @@ __all__ = [ | |
| 31 30 | 
             
                "BaseRepository",
         | 
| 32 31 |  | 
| 33 32 | 
             
                # Database
         | 
| 34 | 
            -
                " | 
| 33 | 
            +
                "DatabaseService",
         | 
| 35 34 |  | 
| 36 35 | 
             
                # Exceptions
         | 
| 37 36 | 
             
                "CustomException",
         | 
    
        aiteamutils/base_repository.py
    CHANGED
    
    | @@ -1,12 +1,13 @@ | |
| 1 1 | 
             
            """기본 레포지토리 모듈."""
         | 
| 2 | 
            -
            from typing import TypeVar, Generic, Dict, Any, List, Optional, Type
         | 
| 3 | 
            -
            from sqlalchemy.orm import DeclarativeBase
         | 
| 2 | 
            +
            from typing import TypeVar, Generic, Dict, Any, List, Optional, Type, Union
         | 
| 3 | 
            +
            from sqlalchemy.orm import DeclarativeBase, Load
         | 
| 4 4 | 
             
            from sqlalchemy.exc import IntegrityError, SQLAlchemyError
         | 
| 5 5 | 
             
            from sqlalchemy import select, or_, and_
         | 
| 6 | 
            -
            from .database import  | 
| 6 | 
            +
            from .database import DatabaseService
         | 
| 7 7 | 
             
            from .exceptions import CustomException, ErrorCode
         | 
| 8 8 | 
             
            from sqlalchemy.orm import joinedload
         | 
| 9 9 | 
             
            from sqlalchemy.sql import Select
         | 
| 10 | 
            +
            from fastapi import Request
         | 
| 10 11 |  | 
| 11 12 | 
             
            ModelType = TypeVar("ModelType", bound=DeclarativeBase)
         | 
| 12 13 |  | 
| @@ -14,10 +15,10 @@ class BaseRepository(Generic[ModelType]): | |
| 14 15 | 
             
               ##################
         | 
| 15 16 | 
             
                # 1. 초기화 영역 #
         | 
| 16 17 | 
             
                ##################
         | 
| 17 | 
            -
                def __init__(self, db_service:  | 
| 18 | 
            +
                def __init__(self, db_service: DatabaseService, model: Type[ModelType]):
         | 
| 18 19 | 
             
                    """
         | 
| 19 20 | 
             
                    Args:
         | 
| 20 | 
            -
                        db_service ( | 
| 21 | 
            +
                        db_service (DatabaseService): 데이터베이스 서비스 인스턴스
         | 
| 21 22 | 
             
                        model (Type[ModelType]): 모델 클래스
         | 
| 22 23 | 
             
                    """
         | 
| 23 24 | 
             
                    self.db_service = db_service
         | 
    
        aiteamutils/base_service.py
    CHANGED
    
    | @@ -1,9 +1,9 @@ | |
| 1 1 | 
             
            """기본 서비스 모듈."""
         | 
| 2 2 | 
             
            from datetime import datetime
         | 
| 3 3 | 
             
            from typing import TypeVar, Generic, Dict, Any, List, Optional, Type, Union
         | 
| 4 | 
            -
            from sqlalchemy.orm import DeclarativeBase
         | 
| 4 | 
            +
            from sqlalchemy.orm import DeclarativeBase, Load
         | 
| 5 5 | 
             
            from sqlalchemy.exc import IntegrityError, SQLAlchemyError
         | 
| 6 | 
            -
            from .database import  | 
| 6 | 
            +
            from .database import DatabaseService
         | 
| 7 7 | 
             
            from .exceptions import CustomException, ErrorCode
         | 
| 8 8 | 
             
            from .base_repository import BaseRepository
         | 
| 9 9 | 
             
            from .security import hash_password
         | 
    
        aiteamutils/database.py
    CHANGED
    
    | @@ -17,9 +17,9 @@ from .config import settings | |
| 17 17 |  | 
| 18 18 | 
             
            T = TypeVar("T", bound=BaseColumn)
         | 
| 19 19 |  | 
| 20 | 
            -
            class  | 
| 20 | 
            +
            class DatabaseService:
         | 
| 21 21 | 
             
                def __init__(self, db_url: str):
         | 
| 22 | 
            -
                    """ | 
| 22 | 
            +
                    """DatabaseService 초기화.
         | 
| 23 23 |  | 
| 24 24 | 
             
                    Args:
         | 
| 25 25 | 
             
                        db_url: 데이터베이스 URL
         | 
| @@ -173,7 +173,7 @@ class DatabaseManager: | |
| 173 173 | 
             
                            raise CustomException(
         | 
| 174 174 | 
             
                                ErrorCode.DUPLICATE_ERROR,
         | 
| 175 175 | 
             
                                detail=f"{model.__tablename__}|{field}|{value}",
         | 
| 176 | 
            -
                                source_function=" | 
| 176 | 
            +
                                source_function="DatabaseService.create_entity",
         | 
| 177 177 | 
             
                                original_error=e
         | 
| 178 178 | 
             
                            )
         | 
| 179 179 | 
             
                        elif "violates foreign key constraint" in error_str.lower():
         | 
| @@ -181,14 +181,14 @@ class DatabaseManager: | |
| 181 181 | 
             
                            raise CustomException(
         | 
| 182 182 | 
             
                                ErrorCode.FOREIGN_KEY_VIOLATION,
         | 
| 183 183 | 
             
                                detail=error_str,
         | 
| 184 | 
            -
                                source_function=" | 
| 184 | 
            +
                                source_function="DatabaseService.create_entity",
         | 
| 185 185 | 
             
                                original_error=e
         | 
| 186 186 | 
             
                            )
         | 
| 187 187 | 
             
                        else:
         | 
| 188 188 | 
             
                            raise CustomException(
         | 
| 189 189 | 
             
                                ErrorCode.DB_CREATE_ERROR,
         | 
| 190 190 | 
             
                                detail=f"Failed to create {model.__name__}: {str(e)}",
         | 
| 191 | 
            -
                                source_function=" | 
| 191 | 
            +
                                source_function="DatabaseService.create_entity",
         | 
| 192 192 | 
             
                                original_error=e
         | 
| 193 193 | 
             
                            )
         | 
| 194 194 | 
             
                    except CustomException as e:
         | 
| @@ -199,7 +199,7 @@ class DatabaseManager: | |
| 199 199 | 
             
                        raise CustomException(
         | 
| 200 200 | 
             
                            ErrorCode.UNEXPECTED_ERROR,
         | 
| 201 201 | 
             
                            detail=f"Unexpected error while creating {model.__name__}: {str(e)}",
         | 
| 202 | 
            -
                            source_function=" | 
| 202 | 
            +
                            source_function="DatabaseService.create_entity",
         | 
| 203 203 | 
             
                            original_error=e
         | 
| 204 204 | 
             
                        )
         | 
| 205 205 |  | 
| @@ -243,7 +243,7 @@ class DatabaseManager: | |
| 243 243 | 
             
                        raise CustomException(
         | 
| 244 244 | 
             
                            ErrorCode.DB_QUERY_ERROR,
         | 
| 245 245 | 
             
                            detail=str(e),
         | 
| 246 | 
            -
                            source_function=" | 
| 246 | 
            +
                            source_function="DatabaseService.retrieve_entity",
         | 
| 247 247 | 
             
                            original_error=e
         | 
| 248 248 | 
             
                        )
         | 
| 249 249 |  | 
| @@ -307,7 +307,7 @@ class DatabaseManager: | |
| 307 307 | 
             
                        raise CustomException(
         | 
| 308 308 | 
             
                            ErrorCode.DB_UPDATE_ERROR,
         | 
| 309 309 | 
             
                            detail=f"Failed to update {model.__name__}: {str(e)}",
         | 
| 310 | 
            -
                            source_function=" | 
| 310 | 
            +
                            source_function="DatabaseService.update_entity",
         | 
| 311 311 | 
             
                            original_error=e
         | 
| 312 312 | 
             
                        )
         | 
| 313 313 | 
             
                    except Exception as e:
         | 
| @@ -315,7 +315,7 @@ class DatabaseManager: | |
| 315 315 | 
             
                        raise CustomException(
         | 
| 316 316 | 
             
                            ErrorCode.UNEXPECTED_ERROR,
         | 
| 317 317 | 
             
                            detail=f"Unexpected error while updating {model.__name__}: {str(e)}",
         | 
| 318 | 
            -
                            source_function=" | 
| 318 | 
            +
                            source_function="DatabaseService.update_entity",
         | 
| 319 319 | 
             
                            original_error=e
         | 
| 320 320 | 
             
                        )
         | 
| 321 321 |  | 
| @@ -337,7 +337,7 @@ class DatabaseManager: | |
| 337 337 | 
             
                        raise CustomException(
         | 
| 338 338 | 
             
                            ErrorCode.DB_DELETE_ERROR,
         | 
| 339 339 | 
             
                            detail=f"Failed to delete entity: {str(e)}",
         | 
| 340 | 
            -
                            source_function=" | 
| 340 | 
            +
                            source_function="DatabaseService.delete_entity",
         | 
| 341 341 | 
             
                            original_error=e
         | 
| 342 342 | 
             
                        )
         | 
| 343 343 | 
             
                    except Exception as e:
         | 
| @@ -345,7 +345,7 @@ class DatabaseManager: | |
| 345 345 | 
             
                        raise CustomException(
         | 
| 346 346 | 
             
                            ErrorCode.UNEXPECTED_ERROR,
         | 
| 347 347 | 
             
                            detail=f"Unexpected error while deleting entity: {str(e)}",
         | 
| 348 | 
            -
                            source_function=" | 
| 348 | 
            +
                            source_function="DatabaseService.delete_entity",
         | 
| 349 349 | 
             
                            original_error=e
         | 
| 350 350 | 
             
                        )
         | 
| 351 351 |  | 
| @@ -392,7 +392,7 @@ class DatabaseManager: | |
| 392 392 | 
             
                        raise CustomException(
         | 
| 393 393 | 
             
                            ErrorCode.DB_DELETE_ERROR,
         | 
| 394 394 | 
             
                            detail=f"Failed to soft delete {model.__name__}: {str(e)}",
         | 
| 395 | 
            -
                            source_function=" | 
| 395 | 
            +
                            source_function="DatabaseService.soft_delete_entity",
         | 
| 396 396 | 
             
                            original_error=e
         | 
| 397 397 | 
             
                        )
         | 
| 398 398 | 
             
                    except Exception as e:
         | 
| @@ -400,7 +400,7 @@ class DatabaseManager: | |
| 400 400 | 
             
                        raise CustomException(
         | 
| 401 401 | 
             
                            ErrorCode.UNEXPECTED_ERROR,
         | 
| 402 402 | 
             
                            detail=f"Unexpected error while soft deleting {model.__name__}: {str(e)}",
         | 
| 403 | 
            -
                            source_function=" | 
| 403 | 
            +
                            source_function="DatabaseService.soft_delete_entity",
         | 
| 404 404 | 
             
                            original_error=e
         | 
| 405 405 | 
             
                        )
         | 
| 406 406 |  | 
| @@ -468,14 +468,14 @@ class DatabaseManager: | |
| 468 468 | 
             
                        raise CustomException(
         | 
| 469 469 | 
             
                            ErrorCode.DB_READ_ERROR,
         | 
| 470 470 | 
             
                            detail=f"Failed to list {model.__name__}: {str(e)}",
         | 
| 471 | 
            -
                            source_function=" | 
| 471 | 
            +
                            source_function="DatabaseService.list_entities",
         | 
| 472 472 | 
             
                            original_error=e
         | 
| 473 473 | 
             
                        )
         | 
| 474 474 | 
             
                    except Exception as e:
         | 
| 475 475 | 
             
                        raise CustomException(
         | 
| 476 476 | 
             
                            ErrorCode.UNEXPECTED_ERROR,
         | 
| 477 477 | 
             
                            detail=f"Unexpected error while listing {model.__name__}: {str(e)}",
         | 
| 478 | 
            -
                            source_function=" | 
| 478 | 
            +
                            source_function="DatabaseService.list_entities",
         | 
| 479 479 | 
             
                            original_error=e
         | 
| 480 480 | 
             
                        )
         | 
| 481 481 |  | 
| @@ -524,14 +524,14 @@ class DatabaseManager: | |
| 524 524 | 
             
                            raise CustomException(
         | 
| 525 525 | 
             
                                error_code,
         | 
| 526 526 | 
             
                                detail=detail,
         | 
| 527 | 
            -
                                source_function=" | 
| 527 | 
            +
                                source_function="DatabaseService.validate_unique_fields"
         | 
| 528 528 | 
             
                            )
         | 
| 529 529 |  | 
| 530 530 | 
             
                    except CustomException as e:
         | 
| 531 531 | 
             
                        raise CustomException(
         | 
| 532 532 | 
             
                            e.error_code,
         | 
| 533 533 | 
             
                            detail=e.detail,
         | 
| 534 | 
            -
                            source_function=" | 
| 534 | 
            +
                            source_function="DatabaseService.validate_unique_fields",
         | 
| 535 535 | 
             
                            original_error=e.original_error,
         | 
| 536 536 | 
             
                            parent_source_function=e.source_function
         | 
| 537 537 | 
             
                        )
         | 
| @@ -539,7 +539,7 @@ class DatabaseManager: | |
| 539 539 | 
             
                        raise CustomException(
         | 
| 540 540 | 
             
                            ErrorCode.DB_QUERY_ERROR,
         | 
| 541 541 | 
             
                            detail=str(e),
         | 
| 542 | 
            -
                            source_function=" | 
| 542 | 
            +
                            source_function="DatabaseService.validate_unique_fields",
         | 
| 543 543 | 
             
                            original_error=e
         | 
| 544 544 | 
             
                        )
         | 
| 545 545 |  | 
| @@ -577,7 +577,7 @@ class DatabaseManager: | |
| 577 577 | 
             
                                raise CustomException(
         | 
| 578 578 | 
             
                                    ErrorCode.FOREIGN_KEY_VIOLATION,
         | 
| 579 579 | 
             
                                    detail=f"{referenced_table.name}|{field}|{value}",
         | 
| 580 | 
            -
                                    source_function=" | 
| 580 | 
            +
                                    source_function="DatabaseService.validate_foreign_key_fields"
         | 
| 581 581 | 
             
                                )
         | 
| 582 582 |  | 
| 583 583 | 
             
                #######################
         | 
| @@ -637,7 +637,7 @@ class DatabaseManager: | |
| 637 637 | 
             
                            raise CustomException(
         | 
| 638 638 | 
             
                                ErrorCode.NOT_FOUND,
         | 
| 639 639 | 
             
                                detail=f"{model.__name__}|{entity_id}",
         | 
| 640 | 
            -
                                source_function=source_function or " | 
| 640 | 
            +
                                source_function=source_function or "DatabaseService.soft_delete"
         | 
| 641 641 | 
             
                            )
         | 
| 642 642 |  | 
| 643 643 | 
             
                        # 2. 소프트 삭제 처리
         | 
| @@ -665,7 +665,7 @@ class DatabaseManager: | |
| 665 665 | 
             
                        raise CustomException(
         | 
| 666 666 | 
             
                            e.error_code,
         | 
| 667 667 | 
             
                            detail=e.detail,
         | 
| 668 | 
            -
                            source_function=source_function or " | 
| 668 | 
            +
                            source_function=source_function or "DatabaseService.soft_delete",
         | 
| 669 669 | 
             
                            original_error=e.original_error,
         | 
| 670 670 | 
             
                            parent_source_function=e.source_function
         | 
| 671 671 | 
             
                        )
         | 
| @@ -674,7 +674,7 @@ class DatabaseManager: | |
| 674 674 | 
             
                        raise CustomException(
         | 
| 675 675 | 
             
                            ErrorCode.DB_DELETE_ERROR,
         | 
| 676 676 | 
             
                            detail=str(e),
         | 
| 677 | 
            -
                            source_function=source_function or " | 
| 677 | 
            +
                            source_function=source_function or "DatabaseService.soft_delete",
         | 
| 678 678 | 
             
                            original_error=e
         | 
| 679 679 | 
             
                        )
         | 
| 680 680 |  | 
| @@ -704,14 +704,14 @@ class DatabaseManager: | |
| 704 704 | 
             
                        raise CustomException(
         | 
| 705 705 | 
             
                            ErrorCode.DB_READ_ERROR,
         | 
| 706 706 | 
             
                            detail=f"Failed to get {model.__name__}: {str(e)}",
         | 
| 707 | 
            -
                            source_function=" | 
| 707 | 
            +
                            source_function="DatabaseService.get_entity",
         | 
| 708 708 | 
             
                            original_error=e
         | 
| 709 709 | 
             
                        )
         | 
| 710 710 | 
             
                    except Exception as e:
         | 
| 711 711 | 
             
                        raise CustomException(
         | 
| 712 712 | 
             
                            ErrorCode.UNEXPECTED_ERROR,
         | 
| 713 713 | 
             
                            detail=f"Unexpected error while getting {model.__name__}: {str(e)}",
         | 
| 714 | 
            -
                            source_function=" | 
| 714 | 
            +
                            source_function="DatabaseService.get_entity",
         | 
| 715 715 | 
             
                            original_error=e
         | 
| 716 716 | 
             
                        )
         | 
| 717 717 |  | 
| @@ -757,14 +757,14 @@ class DatabaseManager: | |
| 757 757 | 
             
                        raise CustomException(
         | 
| 758 758 | 
             
                            ErrorCode.DB_QUERY_ERROR,
         | 
| 759 759 | 
             
                            detail=str(e),
         | 
| 760 | 
            -
                            source_function=" | 
| 760 | 
            +
                            source_function="DatabaseService.execute",
         | 
| 761 761 | 
             
                            original_error=e
         | 
| 762 762 | 
             
                        )
         | 
| 763 763 | 
             
                    except Exception as e:
         | 
| 764 764 | 
             
                        raise CustomException(
         | 
| 765 765 | 
             
                            ErrorCode.UNEXPECTED_ERROR,
         | 
| 766 766 | 
             
                            detail=str(e),
         | 
| 767 | 
            -
                            source_function=" | 
| 767 | 
            +
                            source_function="DatabaseService.execute",
         | 
| 768 768 | 
             
                            original_error=e
         | 
| 769 769 | 
             
                        )
         | 
| 770 770 |  | 
| @@ -777,7 +777,7 @@ class DatabaseManager: | |
| 777 777 | 
             
                        raise CustomException(
         | 
| 778 778 | 
             
                            ErrorCode.DB_QUERY_ERROR,
         | 
| 779 779 | 
             
                            detail=str(e),
         | 
| 780 | 
            -
                            source_function=" | 
| 780 | 
            +
                            source_function="DatabaseService.commit",
         | 
| 781 781 | 
             
                            original_error=e
         | 
| 782 782 | 
             
                        )
         | 
| 783 783 |  | 
| @@ -789,7 +789,7 @@ class DatabaseManager: | |
| 789 789 | 
             
                        raise CustomException(
         | 
| 790 790 | 
             
                            ErrorCode.DB_QUERY_ERROR,
         | 
| 791 791 | 
             
                            detail=str(e),
         | 
| 792 | 
            -
                            source_function=" | 
| 792 | 
            +
                            source_function="DatabaseService.rollback",
         | 
| 793 793 | 
             
                            original_error=e
         | 
| 794 794 | 
             
                        )
         | 
| 795 795 |  | 
| @@ -802,7 +802,7 @@ class DatabaseManager: | |
| 802 802 | 
             
                        raise CustomException(
         | 
| 803 803 | 
             
                            ErrorCode.DB_QUERY_ERROR,
         | 
| 804 804 | 
             
                            detail=str(e),
         | 
| 805 | 
            -
                            source_function=" | 
| 805 | 
            +
                            source_function="DatabaseService.flush",
         | 
| 806 806 | 
             
                            original_error=e
         | 
| 807 807 | 
             
                        )
         | 
| 808 808 |  | 
| @@ -818,6 +818,6 @@ class DatabaseManager: | |
| 818 818 | 
             
                        raise CustomException(
         | 
| 819 819 | 
             
                            ErrorCode.DB_QUERY_ERROR,
         | 
| 820 820 | 
             
                            detail=str(e),
         | 
| 821 | 
            -
                            source_function=" | 
| 821 | 
            +
                            source_function="DatabaseService.refresh",
         | 
| 822 822 | 
             
                            original_error=e
         | 
| 823 823 | 
             
                        )
         | 
    
        aiteamutils/validators.py
    CHANGED
    
    | @@ -1,13 +1,16 @@ | |
| 1 1 | 
             
            """유효성 검사 관련 유틸리티 함수들을 모아둔 모듈입니다."""
         | 
| 2 2 |  | 
| 3 | 
            -
            from typing import Any, Optional,  | 
| 3 | 
            +
            from typing import Type, Dict, Any, Callable, TypeVar, Optional, List, Union
         | 
| 4 | 
            +
            from functools import wraps
         | 
| 5 | 
            +
            from sqlalchemy import Table
         | 
| 4 6 | 
             
            from sqlalchemy.ext.asyncio import AsyncSession
         | 
| 5 | 
            -
            from  | 
| 6 | 
            -
            from  | 
| 7 | 
            +
            from fastapi import Request
         | 
| 8 | 
            +
            from inspect import signature
         | 
| 9 | 
            +
            from pydantic import BaseModel
         | 
| 7 10 | 
             
            import re
         | 
| 8 11 |  | 
| 9 12 | 
             
            from .exceptions import ErrorCode, CustomException
         | 
| 10 | 
            -
            from .database import  | 
| 13 | 
            +
            from .database import DatabaseService
         | 
| 11 14 | 
             
            from .base_model import Base
         | 
| 12 15 |  | 
| 13 16 | 
             
            def validate_with(validator_func, unique_check=None, skip_if_none=False):
         | 
    
        aiteamutils/version.py
    ADDED
    
    
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            Metadata-Version: 2.4
         | 
| 2 2 | 
             
            Name: aiteamutils
         | 
| 3 | 
            -
            Version: 0.2. | 
| 3 | 
            +
            Version: 0.2.4
         | 
| 4 4 | 
             
            Summary: AI Team Utilities
         | 
| 5 5 | 
             
            Project-URL: Homepage, https://github.com/yourusername/aiteamutils
         | 
| 6 6 | 
             
            Project-URL: Issues, https://github.com/yourusername/aiteamutils/issues
         | 
| @@ -27,17 +27,21 @@ pip install aiteamutils | |
| 27 27 | 
             
            ## 사용 예시
         | 
| 28 28 |  | 
| 29 29 | 
             
            ```python
         | 
| 30 | 
            -
            from aiteamutils.database import  | 
| 31 | 
            -
            from aiteamutils.base_model import Base
         | 
| 30 | 
            +
            from aiteamutils.database import DatabaseService
         | 
| 32 31 |  | 
| 33 | 
            -
            # DB  | 
| 34 | 
            -
             | 
| 32 | 
            +
            # DB 서비스 초기화
         | 
| 33 | 
            +
            db_service = DatabaseService("postgresql+asyncpg://user:pass@localhost/db")
         | 
| 35 34 |  | 
| 36 35 | 
             
            # DB 세션 사용
         | 
| 37 | 
            -
            async with  | 
| 36 | 
            +
            async with db_service.get_db() as session:
         | 
| 38 37 | 
             
                # DB 작업 수행
         | 
| 39 38 | 
             
                pass
         | 
| 40 39 |  | 
| 40 | 
            +
            # 트랜잭션 사용
         | 
| 41 | 
            +
            async with db_service.transaction():
         | 
| 42 | 
            +
                # 트랜잭션 내 작업 수행
         | 
| 43 | 
            +
                result = await db_service.create_entity(UserModel, {"name": "test"})
         | 
| 44 | 
            +
             | 
| 41 45 | 
             
            # 예외 처리
         | 
| 42 46 | 
             
            from aiteamutils.exceptions import CustomException, ErrorCode
         | 
| 43 47 |  | 
| @@ -55,6 +59,8 @@ except CustomException as e: | |
| 55 59 | 
             
              - 세션 관리
         | 
| 56 60 | 
             
              - 트랜잭션 관리
         | 
| 57 61 | 
             
              - 기본 CRUD 작업
         | 
| 62 | 
            +
              - 외래키 검증
         | 
| 63 | 
            +
              - 유니크 필드 검증
         | 
| 58 64 |  | 
| 59 65 | 
             
            - 인증/인가 유틸리티
         | 
| 60 66 | 
             
              - JWT 토큰 관리
         | 
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            aiteamutils/__init__.py,sha256=-pgR1RkjBjcIgfkKSeEy65G6jsDStFM4DdiQU8Fwcmg,1239
         | 
| 2 | 
            +
            aiteamutils/base_model.py,sha256=ODEnjvUVoxQ1RPCfq8-uZTfTADIA4c7Z3E6G4EVsSX0,2708
         | 
| 3 | 
            +
            aiteamutils/base_repository.py,sha256=qdwQ7Sj2fUqxpDg6cWM48n_QbwPK_VUlG9zTSem8iCk,18968
         | 
| 4 | 
            +
            aiteamutils/base_service.py,sha256=E4dHGE0DvhmRyFplh46SwKJOSF_nUL7OAsCkf_ZJF_8,24733
         | 
| 5 | 
            +
            aiteamutils/cache.py,sha256=tr0Yn8VPYA9QHiKCUzciVlQ2J1RAwNo2K9lGMH4rY3s,1334
         | 
| 6 | 
            +
            aiteamutils/config.py,sha256=vC6k6E2-Y4mD0E0kw6WVgSatCl9K_BtTwrVFhLrhCzs,665
         | 
| 7 | 
            +
            aiteamutils/database.py,sha256=U71cexPsSmMTKgp098I574PupqnuPltujI4QKHBG2Cc,29952
         | 
| 8 | 
            +
            aiteamutils/dependencies.py,sha256=EJeVtq_lACuoheVhkX23N9xiak9bGD-t3-2JtlgBki0,4850
         | 
| 9 | 
            +
            aiteamutils/enums.py,sha256=ipZi6k_QD5-3QV7Yzv7bnL0MjDz-vqfO9I5L77biMKs,632
         | 
| 10 | 
            +
            aiteamutils/exceptions.py,sha256=YV-ISya4wQlHk4twvGo16I5r8h22-tXpn9wa-b3WwDM,15231
         | 
| 11 | 
            +
            aiteamutils/security.py,sha256=AZszaTxVEGi1jU1sX3QXHGgshp1lVvd0xXvZejXvs_w,12643
         | 
| 12 | 
            +
            aiteamutils/validators.py,sha256=9BHm9Zy9paHLArWXbXYjXBQYjOs4XEvM7kAaGEFvz7Q,7747
         | 
| 13 | 
            +
            aiteamutils/version.py,sha256=qj505TIaEPXVKdETV9MIkFSGabI0IySNMFg-Ms5MO48,42
         | 
| 14 | 
            +
            aiteamutils-0.2.4.dist-info/METADATA,sha256=nCAT9SdxKDTxRGaO9nxKZs5bhCKzG8C09uo0-ahDgT0,1717
         | 
| 15 | 
            +
            aiteamutils-0.2.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
         | 
| 16 | 
            +
            aiteamutils-0.2.4.dist-info/RECORD,,
         | 
| @@ -1,15 +0,0 @@ | |
| 1 | 
            -
            aiteamutils/__init__.py,sha256=zmfBXBwNWdbJKCt1rmHk_czHJLmVF-oqRuqq8tf0t0U,1229
         | 
| 2 | 
            -
            aiteamutils/base_model.py,sha256=ODEnjvUVoxQ1RPCfq8-uZTfTADIA4c7Z3E6G4EVsSX0,2708
         | 
| 3 | 
            -
            aiteamutils/base_repository.py,sha256=TQAXajQaaXIAJAFr9n5R2ikcu1TSq-E-_AjXgsND5c4,18927
         | 
| 4 | 
            -
            aiteamutils/base_service.py,sha256=cqPP74ya6r8twJyU3Bc6ARxKiRL8fQIIZZnhDHxBQXE,24727
         | 
| 5 | 
            -
            aiteamutils/cache.py,sha256=tr0Yn8VPYA9QHiKCUzciVlQ2J1RAwNo2K9lGMH4rY3s,1334
         | 
| 6 | 
            -
            aiteamutils/config.py,sha256=vC6k6E2-Y4mD0E0kw6WVgSatCl9K_BtTwrVFhLrhCzs,665
         | 
| 7 | 
            -
            aiteamutils/database.py,sha256=NwLgDIGSaWTORR5eU3W2rYSUlKPKJCWqF2f5yzLyf7A,29952
         | 
| 8 | 
            -
            aiteamutils/dependencies.py,sha256=EJeVtq_lACuoheVhkX23N9xiak9bGD-t3-2JtlgBki0,4850
         | 
| 9 | 
            -
            aiteamutils/enums.py,sha256=ipZi6k_QD5-3QV7Yzv7bnL0MjDz-vqfO9I5L77biMKs,632
         | 
| 10 | 
            -
            aiteamutils/exceptions.py,sha256=YV-ISya4wQlHk4twvGo16I5r8h22-tXpn9wa-b3WwDM,15231
         | 
| 11 | 
            -
            aiteamutils/security.py,sha256=AZszaTxVEGi1jU1sX3QXHGgshp1lVvd0xXvZejXvs_w,12643
         | 
| 12 | 
            -
            aiteamutils/validators.py,sha256=GA2idwDtbQynle7tya10cAnJ6DvLIFsJ746We0V-30k,7630
         | 
| 13 | 
            -
            aiteamutils-0.2.2.dist-info/METADATA,sha256=kOqyfN5HkeRdM6L7jEttopFCIbbFxQLqKdxWQhtLLT0,1527
         | 
| 14 | 
            -
            aiteamutils-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
         | 
| 15 | 
            -
            aiteamutils-0.2.2.dist-info/RECORD,,
         | 
| 
            File without changes
         |