ipulse-shared-core-ftredge 6.8.1__tar.gz → 6.9.1__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 ipulse-shared-core-ftredge might be problematic. Click here for more details.
- {ipulse_shared_core_ftredge-6.8.1/src/ipulse_shared_core_ftredge.egg-info → ipulse_shared_core_ftredge-6.9.1}/PKG-INFO +2 -2
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/setup.py +2 -2
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/__init__.py +3 -2
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/models/__init__.py +1 -1
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/models/base_api_response.py +1 -1
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/services/__init__.py +1 -1
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/services/base_firestore_service.py +16 -16
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1/src/ipulse_shared_core_ftredge.egg-info}/PKG-INFO +2 -2
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge.egg-info/SOURCES.txt +1 -1
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge.egg-info/requires.txt +1 -1
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/LICENCE +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/README.md +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/pyproject.toml +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/setup.cfg +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/dependencies/__init__.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/dependencies/auth_router.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/dependencies/authorization_api.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/dependencies/database.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/dependencies/token_validation.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/models/base_data_model.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/models/organization_profile.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/models/resource_catalog_item.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/models/subscription.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/models/user_auth.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/models/user_profile.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/models/user_profile_update.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/models/user_status.py +0 -0
- /ipulse_shared_core_ftredge-6.8.1/src/ipulse_shared_core_ftredge/services/base_exceptions.py → /ipulse_shared_core_ftredge-6.9.1/src/ipulse_shared_core_ftredge/services/base_service_exceptions.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/services/fastapiservicemon.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/services/servicemon.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/utils/__init__.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge/utils/json_encoder.py +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge.egg-info/dependency_links.txt +0 -0
- {ipulse_shared_core_ftredge-6.8.1 → ipulse_shared_core_ftredge-6.9.1}/src/ipulse_shared_core_ftredge.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: ipulse_shared_core_ftredge
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.9.1
|
|
4
4
|
Summary: Shared Core models and Logger util for the Pulse platform project. Using AI for financial advisory and investment management.
|
|
5
5
|
Home-page: https://github.com/TheFutureEdge/ipulse_shared_core
|
|
6
6
|
Author: Russlan Ramdowar
|
|
@@ -9,7 +9,7 @@ Requires-Dist: pydantic[email]~=2.5
|
|
|
9
9
|
Requires-Dist: python-dateutil~=2.8
|
|
10
10
|
Requires-Dist: fastapi~=0.115.8
|
|
11
11
|
Requires-Dist: pytest~=7.1
|
|
12
|
-
Requires-Dist: ipulse_shared_base_ftredge>=5.
|
|
12
|
+
Requires-Dist: ipulse_shared_base_ftredge>=5.7.1
|
|
13
13
|
Dynamic: author
|
|
14
14
|
Dynamic: home-page
|
|
15
15
|
Dynamic: requires-dist
|
|
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
|
|
|
3
3
|
|
|
4
4
|
setup(
|
|
5
5
|
name='ipulse_shared_core_ftredge',
|
|
6
|
-
version='6.
|
|
6
|
+
version='6.9.1',
|
|
7
7
|
package_dir={'': 'src'}, # Specify the source directory
|
|
8
8
|
packages=find_packages(where='src'), # Look for packages in 'src'
|
|
9
9
|
install_requires=[
|
|
@@ -12,7 +12,7 @@ setup(
|
|
|
12
12
|
'python-dateutil~=2.8',
|
|
13
13
|
'fastapi~=0.115.8',
|
|
14
14
|
'pytest~=7.1',
|
|
15
|
-
'ipulse_shared_base_ftredge>=5.
|
|
15
|
+
'ipulse_shared_base_ftredge>=5.7.1',
|
|
16
16
|
],
|
|
17
17
|
author='Russlan Ramdowar',
|
|
18
18
|
description='Shared Core models and Logger util for the Pulse platform project. Using AI for financial advisory and investment management.',
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# pylint: disable=missing-module-docstring
|
|
2
2
|
from .models import ( UserAuth, UserProfile,Subscription,
|
|
3
3
|
UserStatus, UserProfileUpdate,
|
|
4
|
-
OrganizationProfile, BaseAPIResponse,
|
|
4
|
+
OrganizationProfile, BaseAPIResponse,
|
|
5
|
+
CustomJSONResponse )
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
from .services import (BaseFirestoreService,BaseServiceException, ResourceNotFoundError, AuthorizationError,
|
|
9
10
|
ValidationError)
|
|
10
11
|
|
|
11
|
-
from .utils import (CustomJSONEncoder)
|
|
12
|
+
from .utils import (CustomJSONEncoder)
|
|
@@ -4,7 +4,7 @@ from .user_status import UserStatus
|
|
|
4
4
|
from .user_profile_update import UserProfileUpdate
|
|
5
5
|
from .user_auth import UserAuth
|
|
6
6
|
from .organization_profile import OrganizationProfile
|
|
7
|
-
from .base_api_response import BaseAPIResponse, CustomJSONResponse
|
|
7
|
+
from .base_api_response import BaseAPIResponse , CustomJSONResponse
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from .base_firestore_service import BaseFirestoreService
|
|
2
2
|
|
|
3
|
-
from .
|
|
3
|
+
from .base_service_exceptions import (BaseServiceException, ResourceNotFoundError, AuthorizationError,
|
|
4
4
|
ValidationError ,ServiceError)
|
|
5
5
|
from .servicemon import Servicemon
|
|
6
6
|
from .fastapiservicemon import FastAPIServiceMon
|
|
@@ -4,13 +4,13 @@ import logging
|
|
|
4
4
|
from datetime import datetime, timezone
|
|
5
5
|
from pydantic import BaseModel
|
|
6
6
|
from google.cloud import firestore
|
|
7
|
-
from .
|
|
7
|
+
from .base_service_exceptions import ResourceNotFoundError, ValidationError, ServiceError
|
|
8
8
|
|
|
9
9
|
T = TypeVar('T', bound=BaseModel)
|
|
10
10
|
|
|
11
11
|
class BaseFirestoreService(Generic[T]):
|
|
12
12
|
"""Base class for Firestore services with common CRUD operations"""
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
def __init__(self, db: firestore.Client, collection_name: str, resource_type: str, logger: logging.Logger):
|
|
15
15
|
self.db = db
|
|
16
16
|
self.collection_name = collection_name
|
|
@@ -22,7 +22,7 @@ class BaseFirestoreService(Generic[T]):
|
|
|
22
22
|
try:
|
|
23
23
|
current_time = datetime.now(timezone.utc)
|
|
24
24
|
doc_data = data.model_dump(mode='json')
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
# Add audit fields
|
|
27
27
|
doc_data.update({
|
|
28
28
|
'creat_date': current_time.isoformat(),
|
|
@@ -33,7 +33,7 @@ class BaseFirestoreService(Generic[T]):
|
|
|
33
33
|
|
|
34
34
|
doc_ref = self.db.collection(self.collection_name).document(doc_id)
|
|
35
35
|
doc_ref.set(doc_data)
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
self.logger.info(f"Created {self.resource_type}: {doc_id}")
|
|
38
38
|
return doc_data
|
|
39
39
|
|
|
@@ -61,7 +61,7 @@ class BaseFirestoreService(Generic[T]):
|
|
|
61
61
|
'updt_date': current_time.isoformat(),
|
|
62
62
|
'updt_by_user': creator_uid
|
|
63
63
|
})
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
doc_ref = self.db.collection(self.collection_name).document(doc_data.get('id'))
|
|
66
66
|
batch.set(doc_ref, doc_data)
|
|
67
67
|
created_docs.append(doc_data)
|
|
@@ -83,39 +83,39 @@ class BaseFirestoreService(Generic[T]):
|
|
|
83
83
|
"""Get a document by ID with standardized error handling"""
|
|
84
84
|
doc_ref = self.db.collection(self.collection_name).document(doc_id)
|
|
85
85
|
doc = doc_ref.get()
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
if not doc.exists:
|
|
88
88
|
raise ResourceNotFoundError(
|
|
89
89
|
resource_type=self.resource_type,
|
|
90
90
|
resource_id=doc_id,
|
|
91
91
|
additional_info={"collection": self.collection_name}
|
|
92
92
|
)
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
return doc.to_dict()
|
|
95
95
|
|
|
96
96
|
async def update_document(self, doc_id: str, update_data: Dict[str, Any], updater_uid: str) -> Dict[str, Any]:
|
|
97
97
|
"""Standard update method with validation and audit fields"""
|
|
98
98
|
try:
|
|
99
99
|
doc_ref = self.db.collection(self.collection_name).document(doc_id)
|
|
100
|
-
|
|
100
|
+
|
|
101
101
|
if not doc_ref.get().exists:
|
|
102
102
|
raise ResourceNotFoundError(
|
|
103
103
|
resource_type=self.resource_type,
|
|
104
104
|
resource_id=doc_id,
|
|
105
105
|
additional_info={"collection": self.collection_name}
|
|
106
106
|
)
|
|
107
|
-
|
|
107
|
+
|
|
108
108
|
valid_fields = self._validate_update_fields(update_data)
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
# Add audit fields
|
|
111
111
|
valid_fields.update({
|
|
112
112
|
'updt_date': datetime.now(timezone.utc).isoformat(),
|
|
113
113
|
'updt_by_user': updater_uid
|
|
114
114
|
})
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
doc_ref.update(valid_fields)
|
|
117
117
|
return doc_ref.get().to_dict()
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
except (ResourceNotFoundError, ValidationError):
|
|
120
120
|
raise
|
|
121
121
|
except Exception as e:
|
|
@@ -136,7 +136,7 @@ class BaseFirestoreService(Generic[T]):
|
|
|
136
136
|
resource_type=self.resource_type,
|
|
137
137
|
resource_id=doc_id
|
|
138
138
|
)
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
doc_ref.delete()
|
|
141
141
|
self.logger.info(f"Deleted {self.resource_type}: {doc_id}")
|
|
142
142
|
|
|
@@ -155,17 +155,17 @@ class BaseFirestoreService(Generic[T]):
|
|
|
155
155
|
"""Centralized update fields validation"""
|
|
156
156
|
if not isinstance(update_data, dict):
|
|
157
157
|
update_data = update_data.model_dump(exclude_unset=True)
|
|
158
|
-
|
|
158
|
+
|
|
159
159
|
valid_fields = {
|
|
160
160
|
k: v for k, v in update_data.items()
|
|
161
161
|
if v is not None and not (isinstance(v, (list, dict, set)) and len(v) == 0)
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
|
|
164
164
|
if not valid_fields:
|
|
165
165
|
raise ValidationError(
|
|
166
166
|
resource_type=self.resource_type,
|
|
167
167
|
detail="No valid fields to update",
|
|
168
168
|
resource_id=None
|
|
169
169
|
)
|
|
170
|
-
|
|
170
|
+
|
|
171
171
|
return valid_fields
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: ipulse_shared_core_ftredge
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.9.1
|
|
4
4
|
Summary: Shared Core models and Logger util for the Pulse platform project. Using AI for financial advisory and investment management.
|
|
5
5
|
Home-page: https://github.com/TheFutureEdge/ipulse_shared_core
|
|
6
6
|
Author: Russlan Ramdowar
|
|
@@ -9,7 +9,7 @@ Requires-Dist: pydantic[email]~=2.5
|
|
|
9
9
|
Requires-Dist: python-dateutil~=2.8
|
|
10
10
|
Requires-Dist: fastapi~=0.115.8
|
|
11
11
|
Requires-Dist: pytest~=7.1
|
|
12
|
-
Requires-Dist: ipulse_shared_base_ftredge>=5.
|
|
12
|
+
Requires-Dist: ipulse_shared_base_ftredge>=5.7.1
|
|
13
13
|
Dynamic: author
|
|
14
14
|
Dynamic: home-page
|
|
15
15
|
Dynamic: requires-dist
|
|
@@ -24,8 +24,8 @@ src/ipulse_shared_core_ftredge/models/user_profile.py
|
|
|
24
24
|
src/ipulse_shared_core_ftredge/models/user_profile_update.py
|
|
25
25
|
src/ipulse_shared_core_ftredge/models/user_status.py
|
|
26
26
|
src/ipulse_shared_core_ftredge/services/__init__.py
|
|
27
|
-
src/ipulse_shared_core_ftredge/services/base_exceptions.py
|
|
28
27
|
src/ipulse_shared_core_ftredge/services/base_firestore_service.py
|
|
28
|
+
src/ipulse_shared_core_ftredge/services/base_service_exceptions.py
|
|
29
29
|
src/ipulse_shared_core_ftredge/services/fastapiservicemon.py
|
|
30
30
|
src/ipulse_shared_core_ftredge/services/servicemon.py
|
|
31
31
|
src/ipulse_shared_core_ftredge/utils/__init__.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|