ipulse-shared-core-ftredge 27.4.0__tar.gz → 27.5.0__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.

Files changed (62) hide show
  1. {ipulse_shared_core_ftredge-27.4.0/src/ipulse_shared_core_ftredge.egg-info → ipulse_shared_core_ftredge-27.5.0}/PKG-INFO +2 -2
  2. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/setup.py +2 -2
  3. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/__init__.py +1 -1
  4. ipulse_shared_core_ftredge-27.4.0/src/ipulse_shared_core_ftredge/models/base_data_model.py → ipulse_shared_core_ftredge-27.5.0/src/ipulse_shared_core_ftredge/models/base_nosql_model.py +34 -10
  5. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/catalog/subscriptionplan.py +5 -11
  6. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/catalog/usertype.py +5 -10
  7. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/time_series_packaged_dataset_model.py +9 -10
  8. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/user/user_subscription.py +5 -9
  9. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/user/userprofile.py +6 -9
  10. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/user/userstatus.py +5 -12
  11. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/base/cache_aware_firestore_service.py +4 -5
  12. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/base/multi_collection_cache_aware_firestore_service.py +4 -4
  13. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/charging_processors.py +2 -2
  14. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0/src/ipulse_shared_core_ftredge.egg-info}/PKG-INFO +2 -2
  15. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge.egg-info/SOURCES.txt +1 -1
  16. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge.egg-info/requires.txt +1 -1
  17. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/LICENCE +0 -0
  18. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/README.md +0 -0
  19. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/pyproject.toml +0 -0
  20. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/setup.cfg +0 -0
  21. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/__init__.py +0 -0
  22. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/cache/__init__.py +0 -0
  23. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/cache/shared_cache.py +0 -0
  24. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/dependencies/__init__.py +0 -0
  25. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/dependencies/auth_firebase_token_validation.py +0 -0
  26. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/dependencies/auth_protected_router.py +0 -0
  27. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/dependencies/authz_credit_extraction.py +0 -0
  28. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/dependencies/authz_for_apis.py +0 -0
  29. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/dependencies/firestore_client.py +0 -0
  30. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/exceptions/__init__.py +0 -0
  31. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/exceptions/base_exceptions.py +0 -0
  32. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/exceptions/user_exceptions.py +0 -0
  33. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/base_api_response.py +0 -0
  34. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/catalog/__init__.py +0 -0
  35. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/credit_api_response.py +0 -0
  36. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/custom_json_response.py +0 -0
  37. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/user/__init__.py +0 -0
  38. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/user/user_permissions.py +0 -0
  39. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/models/user/userauth.py +0 -0
  40. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/monitoring/__init__.py +0 -0
  41. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/monitoring/tracemon.py +0 -0
  42. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/__init__.py +0 -0
  43. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/base/__init__.py +0 -0
  44. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/base/base_firestore_service.py +0 -0
  45. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/catalog/__init__.py +0 -0
  46. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/catalog/catalog_subscriptionplan_service.py +0 -0
  47. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/catalog/catalog_usertype_service.py +0 -0
  48. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/user/__init__.py +0 -0
  49. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/user/user_charging_operations.py +0 -0
  50. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/user/user_core_service.py +0 -0
  51. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/user/user_multistep_operations.py +0 -0
  52. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/user/user_permissions_operations.py +0 -0
  53. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/user/user_subscription_operations.py +0 -0
  54. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/user/userauth_operations.py +0 -0
  55. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/user/userprofile_operations.py +0 -0
  56. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/user/userstatus_operations.py +0 -0
  57. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/services/user_charging_service.py +0 -0
  58. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/utils/__init__.py +0 -0
  59. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/utils/custom_json_encoder.py +0 -0
  60. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge/utils/json_encoder.py +0 -0
  61. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge.egg-info/dependency_links.txt +0 -0
  62. {ipulse_shared_core_ftredge-27.4.0 → ipulse_shared_core_ftredge-27.5.0}/src/ipulse_shared_core_ftredge.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipulse_shared_core_ftredge
3
- Version: 27.4.0
3
+ Version: 27.5.0
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
@@ -12,7 +12,7 @@ License-File: LICENCE
12
12
  Requires-Dist: pydantic[email]~=2.5
13
13
  Requires-Dist: python-dateutil~=2.8
14
14
  Requires-Dist: fastapi~=0.115.8
15
- Requires-Dist: ipulse_shared_base_ftredge~=12.2.0
15
+ Requires-Dist: ipulse_shared_base_ftredge~=12.3.0
16
16
  Dynamic: author
17
17
  Dynamic: classifier
18
18
  Dynamic: home-page
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
3
3
 
4
4
  setup(
5
5
  name='ipulse_shared_core_ftredge',
6
- version='27.4.0',
6
+ version='27.5.0',
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=[
@@ -11,7 +11,7 @@ setup(
11
11
  'pydantic[email]~=2.5',
12
12
  'python-dateutil~=2.8',
13
13
  'fastapi~=0.115.8',
14
- 'ipulse_shared_base_ftredge~=12.2.0',
14
+ 'ipulse_shared_base_ftredge~=12.3.0',
15
15
  ],
16
16
  author='Russlan Ramdowar',
17
17
  description='Shared Core models and Logger util for the Pulse platform project. Using AI for financial advisory and investment management.',
@@ -1,4 +1,4 @@
1
- from .base_data_model import BaseDataModel
1
+ from .base_nosql_model import BaseNoSQLModel
2
2
  from .base_api_response import BaseAPIResponse, PaginatedAPIResponse
3
3
  from .credit_api_response import CreditChargeableAPIResponse, UserCreditBalance, UpdatedUserCreditInfo
4
4
  from .custom_json_response import CustomJSONResponse
@@ -1,31 +1,55 @@
1
1
  from datetime import datetime, timezone
2
- from typing import Any
3
- from typing import ClassVar
4
- from pydantic import BaseModel, Field, ConfigDict, field_validator
2
+ from typing import Any , Optional, ClassVar
3
+ from pydantic import BaseModel, Field, ConfigDict, field_validator, model_validator
5
4
  import dateutil.parser
6
5
 
7
- class BaseDataModel(BaseModel):
6
+ class BaseNoSQLModel(BaseModel):
8
7
  """Base model with common fields and configuration"""
9
8
  model_config = ConfigDict(frozen=False, extra="forbid")
10
9
 
11
10
  # Required class variables that must be defined in subclasses
12
- VERSION: ClassVar[float]
11
+ SCHEMA_ID: ClassVar[str]
12
+ SCHEMA_NAME: ClassVar[str]
13
+ VERSION: ClassVar[int]
13
14
  DOMAIN: ClassVar[str]
14
15
  OBJ_REF: ClassVar[str]
15
16
 
16
- # Schema versioning
17
- schema_version: float = Field(
18
- ..., # Make this required
17
+ # Schema versioning - these will be auto-populated from class variables
18
+ schema_version: int = Field(
19
+ default=None, # Will be auto-populated by model_validator
19
20
  description="Version of this Class == version of DB Schema",
20
21
  frozen=True # Keep schema version frozen for data integrity
21
22
  )
22
23
 
24
+ schema_id: str = Field(
25
+ default=None, # Will be auto-populated by model_validator
26
+ description="Identifier for the schema this document adheres to"
27
+ )
28
+ schema_name: str = Field(
29
+ default=None, # Will be auto-populated by model_validator
30
+ description="Name of the schema this document adheres to"
31
+ )
32
+
23
33
  # Audit fields - created fields are frozen after creation, updated fields are mutable
24
- created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc), frozen=True)
25
- created_by: str = Field(..., frozen=True)
34
+ created_at: Optional[datetime] = Field(default_factory=lambda: datetime.now(timezone.utc), frozen=True)
35
+ created_by: Optional[str] = Field(..., frozen=True)
26
36
  updated_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
27
37
  updated_by: str = Field(...)
28
38
 
39
+ @model_validator(mode='before')
40
+ @classmethod
41
+ def populate_schema_fields(cls, values):
42
+ """Auto-populate schema fields from class variables if not provided"""
43
+ if isinstance(values, dict):
44
+ # Set if not already provided or if None
45
+ if ('schema_version' not in values or values.get('schema_version') is None) and hasattr(cls, 'VERSION'):
46
+ values['schema_version'] = cls.VERSION
47
+ if ('schema_id' not in values or values.get('schema_id') is None) and hasattr(cls, 'SCHEMA_ID'):
48
+ values['schema_id'] = cls.SCHEMA_ID
49
+ if ('schema_name' not in values or values.get('schema_name') is None) and hasattr(cls, 'SCHEMA_NAME'):
50
+ values['schema_name'] = cls.SCHEMA_NAME
51
+ return values
52
+
29
53
  @classmethod
30
54
  def get_collection_name(cls) -> str:
31
55
  """Generate standard collection name"""
@@ -12,7 +12,7 @@ from pydantic import Field, ConfigDict, field_validator,model_validator, BaseMod
12
12
  from ipulse_shared_base_ftredge import (Layer, Module, list_enums_as_lower_strings,
13
13
  SystemSubject, SubscriptionPlanName,ObjectOverallStatus,
14
14
  SubscriptionStatus, TimeUnit)
15
- from ..base_data_model import BaseDataModel
15
+ from ..base_nosql_model import BaseNoSQLModel
16
16
  from ..user.user_permissions import UserPermission
17
17
 
18
18
 
@@ -51,25 +51,19 @@ class PlanUpgradePath(BaseModel):
51
51
 
52
52
 
53
53
  ############################################ !!!!! ALWAYS UPDATE SCHEMA VERSION IF SCHEMA IS BEING MODIFIED !!! ############################################
54
- class SubscriptionPlan(BaseDataModel):
54
+ class SubscriptionPlan(BaseNoSQLModel):
55
55
  """
56
56
  Configuration template for subscription plans stored in Firestore.
57
57
  These templates define the default settings applied when creating user subscriptions.
58
58
  """
59
59
 
60
60
  model_config = ConfigDict(extra="forbid")
61
-
62
- VERSION: ClassVar[float] = 1.0
61
+ SCHEMA_ID: ClassVar[str] = ""
62
+ SCHEMA_NAME: ClassVar[str] = ""
63
+ VERSION: ClassVar[int] = 2
63
64
  DOMAIN: ClassVar[str] = "_".join(list_enums_as_lower_strings(Layer.PULSE_APP, Module.CORE, SystemSubject.CATALOG))
64
65
  OBJ_REF: ClassVar[str] = "subscriptionplan"
65
66
 
66
- # System-managed fields
67
- schema_version: float = Field(
68
- default=VERSION,
69
- description="Version of this Class == version of DB Schema",
70
- frozen=True
71
- )
72
-
73
67
  id: Optional[str] = Field(
74
68
  default=None,
75
69
  description="Unique identifier for this plan template (e.g., 'free_subscription_1'). Auto-generated if not provided.",
@@ -11,7 +11,7 @@ from datetime import datetime
11
11
  from pydantic import Field, ConfigDict, field_validator, model_validator
12
12
  from ipulse_shared_base_ftredge import Layer, Module, list_enums_as_lower_strings, SystemSubject, ObjectOverallStatus
13
13
  from ipulse_shared_base_ftredge.enums.enums_iam import IAMUserType
14
- from ipulse_shared_core_ftredge.models.base_data_model import BaseDataModel
14
+ from ipulse_shared_core_ftredge.models.base_nosql_model import BaseNoSQLModel
15
15
  from ipulse_shared_core_ftredge.models.user.user_permissions import UserPermission
16
16
 
17
17
  # ORIGINAL AUTHOR ="russlan.ramdowar;russlan@ftredge.com"
@@ -19,7 +19,7 @@ from ipulse_shared_core_ftredge.models.user.user_permissions import UserPermissi
19
19
 
20
20
 
21
21
  ############################################ !!!!! ALWAYS UPDATE SCHEMA VERSION IF SCHEMA IS BEING MODIFIED !!! ############################################
22
- class UserType(BaseDataModel):
22
+ class UserType(BaseNoSQLModel):
23
23
  """
24
24
  Configuration template for user type defaults stored in Firestore.
25
25
  These templates define the default settings applied when creating users of specific types.
@@ -27,17 +27,12 @@ class UserType(BaseDataModel):
27
27
 
28
28
  model_config = ConfigDict(extra="forbid")
29
29
 
30
- VERSION: ClassVar[float] = 1.0
30
+ SCHEMA_ID: ClassVar[str] = ""
31
+ SCHEMA_NAME: ClassVar[str] = ""
32
+ VERSION: ClassVar[int] = 1
31
33
  DOMAIN: ClassVar[str] = "_".join(list_enums_as_lower_strings(Layer.PULSE_APP, Module.CORE.name, SystemSubject.CATALOG.name))
32
34
  OBJ_REF: ClassVar[str] = "usertype"
33
35
 
34
- # System-managed fields
35
- schema_version: float = Field(
36
- default=VERSION,
37
- description="Version of this Class == version of DB Schema",
38
- frozen=True
39
- )
40
-
41
36
  id: Optional[str] = Field(
42
37
  default=None,
43
38
  description="Unique identifier for this user type template (e.g., 'superadmin_1', 'authenticated_1'). Auto-generated if not provided.",
@@ -1,25 +1,24 @@
1
1
  # pylint: disable=missing-module-docstring, missing-class-docstring
2
- from typing import List, Optional, TypeVar, Generic
2
+ from typing import List, Optional, TypeVar, Generic, ClassVar
3
3
  from datetime import datetime
4
4
  from pydantic import Field, BaseModel
5
- from ipulse_shared_core_ftredge.models.base_data_model import BaseDataModel
5
+ from ipulse_shared_core_ftredge.models.base_nosql_model import BaseNoSQLModel
6
6
 
7
7
  # Generic type for the records within the dataset
8
8
  RecordsSamplingType = TypeVar('RecordsSamplingType', bound=BaseModel)
9
9
 
10
- class TimeSeriesPackagedDatasetModel(BaseDataModel, Generic[RecordsSamplingType]):
10
+ class TimeSeriesPackagedDatasetModel(BaseNoSQLModel, Generic[RecordsSamplingType]):
11
11
  """
12
12
  An intermediary model for time series datasets that holds aggregated records.
13
13
  It provides a generic way to handle different types of time series records.
14
14
  """
15
- # Subject identification fields
16
- subject_id: str = Field(default="", description="The unique identifier for the subject.")
17
- pulse_sector_category: str = Field(default="", description="The sector category for the subject.")
15
+ SCHEMA_ID: ClassVar[str] = ""
16
+ SCHEMA_NAME: ClassVar[str] = ""
17
+ VERSION: ClassVar[int] = 1
18
+
18
19
 
19
- # Schema identification fields
20
- schema_id: str = Field(default="", description="The unique identifier for the schema.")
21
- schema_name: str = Field(default="", description="The name of the schema.")
22
- schema_version: int = Field(default=1, description="The version of the schema.")
20
+ subject_id: str = Field(default="", description="The unique identifier for the subject.")
21
+ subject_category: str = Field(default="", description="The subject category eg. EQUITY, DERIVATIVE, CRYPTO etc.")
23
22
 
24
23
  # Generic lists for different temporal buckets of records
25
24
  max_bulk_records: List[RecordsSamplingType] = Field(default_factory=list)
@@ -4,7 +4,7 @@ import uuid
4
4
  from typing import Optional, ClassVar, Dict, Any, List
5
5
  from pydantic import Field, ConfigDict, model_validator
6
6
  from ipulse_shared_base_ftredge import Layer, Module, list_enums_as_lower_strings, SystemSubject, SubscriptionPlanName, SubscriptionStatus, TimeUnit
7
- from ..base_data_model import BaseDataModel
7
+ from ..base_nosql_model import BaseNoSQLModel
8
8
  from .user_permissions import UserPermission
9
9
  # ORIGINAL AUTHOR ="russlan.ramdowar;russlan@ftredge.com"
10
10
  # CLASS_ORGIN_DATE=datetime(2024, 2, 12, 20, 5)
@@ -14,23 +14,19 @@ DEFAULT_SUBSCRIPTION_PLAN = SubscriptionPlanName.FREE_SUBSCRIPTION
14
14
  DEFAULT_SUBSCRIPTION_STATUS = SubscriptionStatus.ACTIVE
15
15
 
16
16
  ############################################ !!!!! ALWAYS UPDATE SCHEMA VERSION , IF SCHEMA IS BEING MODIFIED !!! ############################################
17
- class UserSubscription(BaseDataModel):
17
+ class UserSubscription(BaseNoSQLModel):
18
18
  """
19
19
  Represents a single subscription cycle with enhanced flexibility and tracking.
20
20
  """
21
21
 
22
22
  model_config = ConfigDict(frozen=True, extra="forbid")
23
23
 
24
- VERSION: ClassVar[float] = 3.0 # Incremented version for direct fields instead of computed
24
+ SCHEMA_ID: ClassVar[str] = ""
25
+ SCHEMA_NAME: ClassVar[str] = ""
26
+ VERSION: ClassVar[int] = 3 # Incremented version for direct fields instead of computed
25
27
  DOMAIN: ClassVar[str] = "_".join(list_enums_as_lower_strings(Layer.PULSE_APP, Module.CORE, SystemSubject.SUBSCRIPTION))
26
28
  OBJ_REF: ClassVar[str] = "subscription"
27
29
 
28
- # System-managed fields (read-only)
29
- schema_version: float = Field(
30
- default=VERSION,
31
- description="Version of this Class == version of DB Schema",
32
- frozen=True
33
- )
34
30
 
35
31
  # Unique identifier for this specific subscription instance - now auto-generated
36
32
  id: Optional[str] = Field(
@@ -4,27 +4,24 @@ import re # Add re import
4
4
  from typing import Set, Optional, ClassVar, Dict, Any, List
5
5
  from pydantic import EmailStr, Field, ConfigDict, model_validator, field_validator
6
6
  from ipulse_shared_base_ftredge import Layer, Module, list_enums_as_lower_strings, SystemSubject, IAMUserType
7
- from ..base_data_model import BaseDataModel
7
+ from ..base_nosql_model import BaseNoSQLModel
8
8
  # ORIGINAL AUTHOR ="Russlan Ramdowar;russlan@ftredge.com"
9
9
  # CLASS_ORGIN_DATE=datetime(2024, 2, 12, 20, 5)
10
10
 
11
11
  ############################ !!!!! ALWAYS UPDATE SCHEMA VERSION , IF SCHEMA IS BEING MODIFIED !!! #################################
12
- class UserProfile(BaseDataModel):
12
+ class UserProfile(BaseNoSQLModel):
13
13
  """
14
14
  User Profile model for storing personal information and settings.
15
15
  """
16
16
  model_config = ConfigDict(frozen=False, extra="forbid") # Allow field modification
17
17
 
18
18
  # Class constants
19
- VERSION: ClassVar[float] = 5.0 # Incremented version for primary_usertype addition
19
+ SCHEMA_ID: ClassVar[str] = ""
20
+ SCHEMA_NAME: ClassVar[str] = ""
21
+ VERSION: ClassVar[int] = 5 # Incremented version for primary_usertype addition
20
22
  DOMAIN: ClassVar[str] = "_".join(list_enums_as_lower_strings(Layer.PULSE_APP, Module.CORE, SystemSubject.USER))
21
23
  OBJ_REF: ClassVar[str] = "userprofile"
22
24
 
23
- schema_version: float = Field(
24
- default=VERSION,
25
- frozen=True,
26
- description="Version of this Class == version of DB Schema"
27
- )
28
25
 
29
26
  id: Optional[str] = Field(
30
27
  default=None, # Will be auto-generated from user_uid if not provided
@@ -104,7 +101,7 @@ class UserProfile(BaseDataModel):
104
101
  description="Additional metadata for the user"
105
102
  )
106
103
 
107
- # Remove audit fields as they're inherited from BaseDataModel
104
+ # Remove audit fields as they're inherited from BaseNoSQLModel
108
105
 
109
106
  @field_validator('user_uid')
110
107
  @classmethod
@@ -5,13 +5,13 @@ from pydantic import Field, ConfigDict, model_validator, field_validator
5
5
  from ipulse_shared_base_ftredge import Layer, Module, list_enums_as_lower_strings, SystemSubject, TimeUnit
6
6
  from ipulse_shared_base_ftredge.enums.enums_iam import IAMUnit
7
7
  from .user_subscription import UserSubscription
8
- from ..base_data_model import BaseDataModel
8
+ from ..base_nosql_model import BaseNoSQLModel
9
9
  from .user_permissions import UserPermission
10
10
 
11
11
 
12
12
 
13
13
  ############################ !!!!! ALWAYS UPDATE SCHEMA VERSION , IF SCHEMA IS BEING MODIFIED !!! #################################
14
- class UserStatus(BaseDataModel):
14
+ class UserStatus(BaseNoSQLModel):
15
15
  """
16
16
  User Status model for tracking user subscription and access rights.
17
17
  """
@@ -19,21 +19,14 @@ class UserStatus(BaseDataModel):
19
19
  model_config = ConfigDict(frozen=False, extra="forbid")
20
20
 
21
21
  # Class constants
22
- VERSION: ClassVar[float] = 7.0 # Major version bump for flattened IAM permissions structure
22
+ SCHEMA_ID: ClassVar[str] = ""
23
+ SCHEMA_NAME: ClassVar[str] = ""
24
+ VERSION: ClassVar[int] = 7 # Major version bump for flattened IAM permissions structure
23
25
  DOMAIN: ClassVar[str] = "_".join(list_enums_as_lower_strings(Layer.PULSE_APP, Module.CORE, SystemSubject.USER))
24
26
  OBJ_REF: ClassVar[str] = "userstatus"
25
-
26
- # Centralized collection name and document ID prefix
27
27
  COLLECTION_NAME: ClassVar[str] = "papp_core_user_userstatuss"
28
28
 
29
29
 
30
- # System-managed fields
31
- schema_version: float = Field(
32
- default=VERSION,
33
- frozen=True,
34
- description="Version of this Class == version of DB Schema"
35
- )
36
-
37
30
  id: Optional[str] = Field(
38
31
  default=None, # Will be auto-generated from user_uid if not provided
39
32
  description=f"User ID, format: {OBJ_REF}_user_uid"
@@ -5,10 +5,9 @@ from google.cloud import firestore
5
5
  from . import BaseFirestoreService
6
6
  from ...exceptions import ResourceNotFoundError, ServiceError
7
7
  from ...cache.shared_cache import SharedCache
8
- from ...models import BaseDataModel
8
+ from ...models import BaseNoSQLModel
9
9
 
10
- T = TypeVar('T', bound=BaseDataModel)0
11
- 0
10
+ T = TypeVar('T', bound=BaseNoSQLModel)
12
11
 
13
12
  class CacheAwareFirestoreService(BaseFirestoreService[T], Generic[T]):
14
13
  """
@@ -75,7 +74,7 @@ class CacheAwareFirestoreService(BaseFirestoreService[T], Generic[T]):
75
74
 
76
75
  # Cache the result if we have a cache and got valid data
77
76
  if self.document_cache and result is not None:
78
- if convert_to_model and isinstance(result, BaseDataModel):
77
+ if convert_to_model and isinstance(result, BaseNoSQLModel):
79
78
  # Cache the model's dict representation
80
79
  self._cache_document_data(doc_id, result.model_dump())
81
80
  elif isinstance(result, dict):
@@ -120,7 +119,7 @@ class CacheAwareFirestoreService(BaseFirestoreService[T], Generic[T]):
120
119
 
121
120
  # Cache the result if we have a cache and got valid data
122
121
  if self.document_cache and result is not None:
123
- if convert_to_model and isinstance(result, BaseDataModel):
122
+ if convert_to_model and isinstance(result, BaseNoSQLModel):
124
123
  # Cache the model's dict representation
125
124
  self._cache_document_data(doc_id, result.model_dump())
126
125
  elif isinstance(result, dict):
@@ -10,11 +10,11 @@ from google.cloud import firestore
10
10
  from .cache_aware_firestore_service import CacheAwareFirestoreService
11
11
  from ...exceptions import ServiceError, ValidationError, ResourceNotFoundError
12
12
  from ...cache.shared_cache import SharedCache
13
- from ...models import BaseDataModel
13
+ from ...models import BaseNoSQLModel
14
14
  import logging
15
15
 
16
- # Generic type for BaseDataModel subclasses
17
- T = TypeVar('T', bound=BaseDataModel)
16
+ # Generic type for BaseNoSQLModel subclasses
17
+ T = TypeVar('T', bound=BaseNoSQLModel)
18
18
 
19
19
 
20
20
  class MultiCollectionCacheAwareFirestoreService(CacheAwareFirestoreService[T], Generic[T]):
@@ -139,7 +139,7 @@ class MultiCollectionCacheAwareFirestoreService(CacheAwareFirestoreService[T], G
139
139
  # Ensure we return model instances
140
140
  model_results: List[T] = []
141
141
  for item in results:
142
- if isinstance(item, BaseDataModel) and self.model_class and isinstance(item, self.model_class):
142
+ if isinstance(item, BaseNoSQLModel) and self.model_class and isinstance(item, self.model_class):
143
143
  model_results.append(item) # type: ignore
144
144
  elif isinstance(item, dict) and self.model_class:
145
145
  try:
@@ -56,7 +56,7 @@ class ChargingProcessor:
56
56
  updated_user_credits = pre_fetched_credits
57
57
  elif self.user_charging_service: # Attempt to get current credits if not pre-fetched
58
58
  try:
59
- _, current_user_credits_from_verify = await self.user_charging_service.verify_enough_credits(user_uid, 0, None)
59
+ _, current_user_credits_from_verify = await self.user_charging_service.verify_enough_credits(user_uid=user_uid, required_credits_for_resource=0, pre_fetched_user_credits=None)
60
60
  updated_user_credits = current_user_credits_from_verify
61
61
  except Exception: # pylint: disable=broad-except
62
62
  self.logger.warning(f"Could not fetch current credits for user {user_uid} for free item.")
@@ -77,7 +77,7 @@ class ChargingProcessor:
77
77
  updated_user_credits = pre_fetched_credits
78
78
  elif self.user_charging_service:
79
79
  try:
80
- _, current_user_credits_from_verify = await self.user_charging_service.verify_enough_credits(user_uid, 0, None)
80
+ _, current_user_credits_from_verify = await self.user_charging_service.verify_enough_credits(user_uid=user_uid, required_credits_for_resource=0, pre_fetched_user_credits=None)
81
81
  updated_user_credits = current_user_credits_from_verify
82
82
  except Exception: # pylint: disable=broad-except
83
83
  self.logger.warning(f"Could not fetch current credits for user {user_uid} during debug bypass.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipulse_shared_core_ftredge
3
- Version: 27.4.0
3
+ Version: 27.5.0
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
@@ -12,7 +12,7 @@ License-File: LICENCE
12
12
  Requires-Dist: pydantic[email]~=2.5
13
13
  Requires-Dist: python-dateutil~=2.8
14
14
  Requires-Dist: fastapi~=0.115.8
15
- Requires-Dist: ipulse_shared_base_ftredge~=12.2.0
15
+ Requires-Dist: ipulse_shared_base_ftredge~=12.3.0
16
16
  Dynamic: author
17
17
  Dynamic: classifier
18
18
  Dynamic: home-page
@@ -21,7 +21,7 @@ src/ipulse_shared_core_ftredge/exceptions/base_exceptions.py
21
21
  src/ipulse_shared_core_ftredge/exceptions/user_exceptions.py
22
22
  src/ipulse_shared_core_ftredge/models/__init__.py
23
23
  src/ipulse_shared_core_ftredge/models/base_api_response.py
24
- src/ipulse_shared_core_ftredge/models/base_data_model.py
24
+ src/ipulse_shared_core_ftredge/models/base_nosql_model.py
25
25
  src/ipulse_shared_core_ftredge/models/credit_api_response.py
26
26
  src/ipulse_shared_core_ftredge/models/custom_json_response.py
27
27
  src/ipulse_shared_core_ftredge/models/time_series_packaged_dataset_model.py
@@ -1,4 +1,4 @@
1
1
  pydantic[email]~=2.5
2
2
  python-dateutil~=2.8
3
3
  fastapi~=0.115.8
4
- ipulse_shared_base_ftredge~=12.2.0
4
+ ipulse_shared_base_ftredge~=12.3.0