internal 1.1.35.2__tar.gz → 1.1.35.3__tar.gz

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.

Potentially problematic release.


This version of internal might be problematic. Click here for more details.

Files changed (40) hide show
  1. {internal-1.1.35.2 → internal-1.1.35.3}/PKG-INFO +1 -1
  2. {internal-1.1.35.2 → internal-1.1.35.3}/pyproject.toml +1 -1
  3. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/model/base_model.py +11 -18
  4. {internal-1.1.35.2 → internal-1.1.35.3}/README.md +0 -0
  5. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/__init__.py +0 -0
  6. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/base_config.py +0 -0
  7. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/base_factory.py +0 -0
  8. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/cache_redis.py +0 -0
  9. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/common_enum/__init__.py +0 -0
  10. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/common_enum/car_relation_type.py +0 -0
  11. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/common_enum/description_type.py +0 -0
  12. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/common_enum/device_code.py +0 -0
  13. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/common_enum/event_code.py +0 -0
  14. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/common_enum/lpr_direction.py +0 -0
  15. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/common_enum/notify_type.py +0 -0
  16. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/common_enum/operator_type.py +0 -0
  17. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/common_enum/order_type.py +0 -0
  18. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/common_enum/point_type.py +0 -0
  19. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/common_enum/websocket_channel.py +0 -0
  20. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/const.py +0 -0
  21. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/database.py +0 -0
  22. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/exception/__init__.py +0 -0
  23. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/exception/app_exception.py +0 -0
  24. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/exception/base_exception.py +0 -0
  25. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/exception/internal_exception.py +0 -0
  26. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/ext/__init__.py +0 -0
  27. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/ext/amazon/__init__.py +0 -0
  28. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/ext/amazon/aws/__init__.py +0 -0
  29. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/ext/amazon/aws/const.py +0 -0
  30. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/http/__init__.py +0 -0
  31. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/http/requests.py +0 -0
  32. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/http/responses.py +0 -0
  33. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/interface/__init__.py +0 -0
  34. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/interface/base_interface.py +0 -0
  35. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/middleware/__init__.py +0 -0
  36. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/middleware/log_request.py +0 -0
  37. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/model/__init__.py +0 -0
  38. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/model/operate.py +0 -0
  39. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/utils.py +0 -0
  40. {internal-1.1.35.2 → internal-1.1.35.3}/src/internal/validator_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: internal
3
- Version: 1.1.35.2
3
+ Version: 1.1.35.3
4
4
  Summary:
5
5
  Author: Ray
6
6
  Author-email: ray@cruisys.com
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "internal"
3
- version = "1.1.35.2"
3
+ version = "1.1.35.3"
4
4
  description = ""
5
5
  authors = [{ name = "Ray", email = "ray@cruisys.com" }]
6
6
  readme = "README.md"
@@ -1,4 +1,5 @@
1
1
  from datetime import datetime
2
+ from idlelib import query
2
3
 
3
4
  from typing import List, Tuple, Union, Dict, Type, Optional, Any, Literal, Union, Set, Mapping
4
5
  import typing_extensions
@@ -27,8 +28,7 @@ class InternalBaseDocument(Document):
27
28
  @classmethod
28
29
  async def get_pagination_list(cls, app: FastAPI, query: list = None, sort: List[Tuple] = None,
29
30
  page_size: int = DEF_PAGE_SIZE, page_no: int = DEF_PAGE_NO,
30
- ignore_cache: bool = False, fetch_links: bool = False,
31
- exclude_fields: List[str] = None):
31
+ ignore_cache: bool = False, fetch_links: bool = False, exclude: Dict = None):
32
32
  if not query:
33
33
  final_query = []
34
34
  else:
@@ -59,15 +59,11 @@ class InternalBaseDocument(Document):
59
59
  else:
60
60
  page_no = max(1, min(page_no, total_pages))
61
61
 
62
- # 建立查詢物件用於取得分頁資料
63
- data_query = cls.find(*final_query, ignore_cache=ignore_cache, fetch_links=fetch_links)
62
+ _query = cls.find(*final_query, ignore_cache=ignore_cache, fetch_links=fetch_links)
63
+ if exclude:
64
+ _query = _query.project(exclude)
64
65
 
65
- # 如果有指定要排除的欄位,使用 project() 方法
66
- if exclude_fields:
67
- projection = {field: 0 for field in exclude_fields}
68
- data_query = data_query.project(projection)
69
-
70
- page_data = await data_query.sort(*final_sort).limit(page_size).skip((page_no - 1) * page_size).to_list()
66
+ page_data = await _query.sort(*final_sort).limit(page_size).skip((page_no - 1) * page_size).to_list()
71
67
 
72
68
  return page_no, page_size, total_num, page_data
73
69
 
@@ -96,7 +92,7 @@ class InternalBaseDocument(Document):
96
92
 
97
93
  @classmethod
98
94
  async def get_list(cls, app: FastAPI, query: list = None, sort: List[Tuple] = None, ignore_cache: bool = False,
99
- fetch_links: bool = False, exclude_fields: List[str] = None):
95
+ fetch_links: bool = False, exclude: Dict = None):
100
96
  if not query:
101
97
  final_query = []
102
98
  else:
@@ -116,15 +112,12 @@ class InternalBaseDocument(Document):
116
112
  continue
117
113
  final_sort.append((cls.id, pymongo.ASCENDING))
118
114
 
119
- # 建立查詢物件
120
- query_obj = cls.find(*final_query, ignore_cache=ignore_cache, fetch_links=fetch_links)
115
+ _query = cls.find(*final_query, ignore_cache=ignore_cache, fetch_links=fetch_links)
116
+ if exclude:
117
+ _query = _query.project(exclude)
121
118
 
122
- # 如果有指定要排除的欄位,使用 project() 方法
123
- if exclude_fields:
124
- projection = {field: 0 for field in exclude_fields}
125
- query_obj = query_obj.project(projection)
119
+ data = await _query.sort(*final_sort).to_list()
126
120
 
127
- data = await query_obj.sort(*final_sort).to_list()
128
121
  return data
129
122
 
130
123
  def model_dump(
File without changes