aiteamutils 0.2.71__py3-none-any.whl → 0.2.73__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/base_service.py +31 -1
 - aiteamutils/database.py +3 -5
 - aiteamutils/version.py +1 -1
 - {aiteamutils-0.2.71.dist-info → aiteamutils-0.2.73.dist-info}/METADATA +1 -1
 - {aiteamutils-0.2.71.dist-info → aiteamutils-0.2.73.dist-info}/RECORD +6 -6
 - {aiteamutils-0.2.71.dist-info → aiteamutils-0.2.73.dist-info}/WHEEL +0 -0
 
    
        aiteamutils/base_service.py
    CHANGED
    
    | 
         @@ -35,7 +35,37 @@ class BaseService(Generic[ModelType]): 
     | 
|
| 
       35 
35 
     | 
    
         
             
                    self,
         
     | 
| 
       36 
36 
     | 
    
         
             
                    skip: int = 0,
         
     | 
| 
       37 
37 
     | 
    
         
             
                    limit: int = 100,
         
     | 
| 
       38 
     | 
    
         
            -
                    filters: Dict[str, Any] | None =
         
     | 
| 
      
 38 
     | 
    
         
            +
                    filters: Dict[str, Any] | None = None,
         
     | 
| 
      
 39 
     | 
    
         
            +
                    search_params: Dict[str, Any] | None = None,
         
     | 
| 
      
 40 
     | 
    
         
            +
                    model_name: str | None = None,
         
     | 
| 
      
 41 
     | 
    
         
            +
                    response_model: Any = None
         
     | 
| 
      
 42 
     | 
    
         
            +
                ) -> List[Dict[str, Any]]:
         
     | 
| 
      
 43 
     | 
    
         
            +
                    try:
         
     | 
| 
      
 44 
     | 
    
         
            +
                        # 검색 조건 처리 및 필터 병합
         
     | 
| 
      
 45 
     | 
    
         
            +
                        if search_params:
         
     | 
| 
      
 46 
     | 
    
         
            +
                            search_filters = build_search_filters(search_params)
         
     | 
| 
      
 47 
     | 
    
         
            +
                            if filters:
         
     | 
| 
      
 48 
     | 
    
         
            +
                                # 기존 filters와 search_filters 병합 (search_filters가 우선 적용)
         
     | 
| 
      
 49 
     | 
    
         
            +
                                filters.update(search_filters)
         
     | 
| 
      
 50 
     | 
    
         
            +
                            else:
         
     | 
| 
      
 51 
     | 
    
         
            +
                                filters = search_filters
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                        # 모델 이름을 통한 동적 처리
         
     | 
| 
      
 54 
     | 
    
         
            +
                        if model_name:
         
     | 
| 
      
 55 
     | 
    
         
            +
                            if model_name not in self.additional_models:
         
     | 
| 
      
 56 
     | 
    
         
            +
                                raise CustomException(
         
     | 
| 
      
 57 
     | 
    
         
            +
                                    ErrorCode.INVALID_REQUEST,
         
     | 
| 
      
 58 
     | 
    
         
            +
                                    detail=f"Model {model_name} not registered",
         
     | 
| 
      
 59 
     | 
    
         
            +
                                    source_function=f"{self.__class__.__name__}.list"
         
     | 
| 
      
 60 
     | 
    
         
            +
                                )
         
     | 
| 
      
 61 
     | 
    
         
            +
                            model = self.additional_models[model_name]
         
     | 
| 
      
 62 
     | 
    
         
            +
                            return await self.repository.list(skip=skip, limit=limit, filters=filters, model=model)
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                        return await self.repository.list(skip=skip, limit=limit, filters=filters)
         
     | 
| 
      
 65 
     | 
    
         
            +
                    except CustomException as e:
         
     | 
| 
      
 66 
     | 
    
         
            +
                        e.detail = f"Service list error for {self.repository.model.__tablename__}: {e.detail}"
         
     | 
| 
      
 67 
     | 
    
         
            +
                        e.source_function = f"{self.__class__.__name__}.list -> {e.source_function}"
         
     | 
| 
      
 68 
     | 
    
         
            +
                        raise e
         
     | 
| 
       39 
69 
     | 
    
         
             
                    except Exception as e:
         
     | 
| 
       40 
70 
     | 
    
         
             
                        raise CustomException(
         
     | 
| 
       41 
71 
     | 
    
         
             
                            ErrorCode.INTERNAL_ERROR,
         
     | 
    
        aiteamutils/database.py
    CHANGED
    
    | 
         @@ -120,14 +120,12 @@ def process_response( 
     | 
|
| 
       120 
120 
     | 
    
         
             
            # 조건 처리 #
         
     | 
| 
       121 
121 
     | 
    
         
             
            ##################
         
     | 
| 
       122 
122 
     | 
    
         
             
            def build_search_filters(
         
     | 
| 
       123 
     | 
    
         
            -
                    request: Dict[str, Any],
         
     | 
| 
       124 
123 
     | 
    
         
             
                    search_params: Dict[str, Dict[str, Any]]
         
     | 
| 
       125 
124 
     | 
    
         
             
            ) -> Dict[str, Any]:
         
     | 
| 
       126 
125 
     | 
    
         
             
                """
         
     | 
| 
       127 
     | 
    
         
            -
                 
     | 
| 
      
 126 
     | 
    
         
            +
                검색 파라미터를 기반으로 필터 조건을 생성합니다.
         
     | 
| 
       128 
127 
     | 
    
         | 
| 
       129 
128 
     | 
    
         
             
                Args:
         
     | 
| 
       130 
     | 
    
         
            -
                    request: 요청 데이터 (key-value 형태).
         
     | 
| 
       131 
129 
     | 
    
         
             
                    search_params: 검색 조건 설정을 위한 파라미터.
         
     | 
| 
       132 
130 
     | 
    
         | 
| 
       133 
131 
     | 
    
         
             
                Returns:
         
     | 
| 
         @@ -135,9 +133,9 @@ def build_search_filters( 
     | 
|
| 
       135 
133 
     | 
    
         
             
                """
         
     | 
| 
       136 
134 
     | 
    
         
             
                filters = {}
         
     | 
| 
       137 
135 
     | 
    
         
             
                for key, param in search_params.items():
         
     | 
| 
       138 
     | 
    
         
            -
                    value =  
     | 
| 
      
 136 
     | 
    
         
            +
                    value = param.get("value")
         
     | 
| 
       139 
137 
     | 
    
         
             
                    if value is not None:
         
     | 
| 
       140 
     | 
    
         
            -
                        if param 
     | 
| 
      
 138 
     | 
    
         
            +
                        if param.get("like", False):
         
     | 
| 
       141 
139 
     | 
    
         
             
                            filters[key] = {"field": param["fields"][0], "operator": "like", "value": f"%{value}%"}
         
     | 
| 
       142 
140 
     | 
    
         
             
                        else:
         
     | 
| 
       143 
141 
     | 
    
         
             
                            filters[key] = {"field": param["fields"][0], "operator": "eq", "value": value}
         
     | 
    
        aiteamutils/version.py
    CHANGED
    
    | 
         @@ -1,2 +1,2 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            """버전 정보"""
         
     | 
| 
       2 
     | 
    
         
            -
            __version__ = "0.2. 
     | 
| 
      
 2 
     | 
    
         
            +
            __version__ = "0.2.73"
         
     | 
| 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            aiteamutils/__init__.py,sha256=kRBpRjark0M8ZwFfmKiMFol6CbIILN3WE4f6_P6iIq0,1089
         
     | 
| 
       2 
2 
     | 
    
         
             
            aiteamutils/base_model.py,sha256=ODEnjvUVoxQ1RPCfq8-uZTfTADIA4c7Z3E6G4EVsSX0,2708
         
     | 
| 
       3 
3 
     | 
    
         
             
            aiteamutils/base_repository.py,sha256=tG_xz4hHYAN3-wkrLvEPxyTucV4pzT6dihoKVJp2JIc,2079
         
     | 
| 
       4 
     | 
    
         
            -
            aiteamutils/base_service.py,sha256= 
     | 
| 
      
 4 
     | 
    
         
            +
            aiteamutils/base_service.py,sha256=M02lAcDmzTul97VBC1H8i5OtNKV8a9En2_sNCz84e-w,2852
         
     | 
| 
       5 
5 
     | 
    
         
             
            aiteamutils/cache.py,sha256=07xBGlgAwOTAdY5mnMOQJ5EBxVwe8glVD7DkGEkxCtw,1373
         
     | 
| 
       6 
6 
     | 
    
         
             
            aiteamutils/config.py,sha256=YdalpJb70-txhGJAS4aaKglEZAFVWgfzw5BXSWpkUz4,3232
         
     | 
| 
       7 
     | 
    
         
            -
            aiteamutils/database.py,sha256= 
     | 
| 
      
 7 
     | 
    
         
            +
            aiteamutils/database.py,sha256=4Z1baj7UISE8KsVC_KilKwtCR4Yp8qR-kbwB7CHpDtE,8032
         
     | 
| 
       8 
8 
     | 
    
         
             
            aiteamutils/enums.py,sha256=ipZi6k_QD5-3QV7Yzv7bnL0MjDz-vqfO9I5L77biMKs,632
         
     | 
| 
       9 
9 
     | 
    
         
             
            aiteamutils/exceptions.py,sha256=_lKWXq_ujNj41xN6LDE149PwsecAP7lgYWbOBbLOntg,15368
         
     | 
| 
       10 
10 
     | 
    
         
             
            aiteamutils/security.py,sha256=xFVrjttxwXB1TTjqgRQQgQJQohQBT28vuW8FVLjvi-M,10103
         
     | 
| 
       11 
11 
     | 
    
         
             
            aiteamutils/validators.py,sha256=PvI9hbMEAqTawgxPbiWRyx2r9yTUrpNBQs1AD3w4F2U,7726
         
     | 
| 
       12 
     | 
    
         
            -
            aiteamutils/version.py,sha256= 
     | 
| 
       13 
     | 
    
         
            -
            aiteamutils-0.2. 
     | 
| 
       14 
     | 
    
         
            -
            aiteamutils-0.2. 
     | 
| 
       15 
     | 
    
         
            -
            aiteamutils-0.2. 
     | 
| 
      
 12 
     | 
    
         
            +
            aiteamutils/version.py,sha256=p9Q6ycHvK4ulfUsk9t-OMhQk41NdIQmGrAm5soMo2OY,42
         
     | 
| 
      
 13 
     | 
    
         
            +
            aiteamutils-0.2.73.dist-info/METADATA,sha256=oGgO7P8aKOYwsEPaGzDSRRIxCXfs3PVqhDT9GCehssM,1718
         
     | 
| 
      
 14 
     | 
    
         
            +
            aiteamutils-0.2.73.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
         
     | 
| 
      
 15 
     | 
    
         
            +
            aiteamutils-0.2.73.dist-info/RECORD,,
         
     | 
| 
         
            File without changes
         
     |