ipulse-shared-core-ftredge 1.3.0__tar.gz → 1.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.
- {ipulse_shared_core_ftredge-1.3.0/src/ipulse_shared_core_ftredge.egg-info → ipulse_shared_core_ftredge-1.5.0}/PKG-INFO +1 -1
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/setup.py +1 -1
- ipulse_shared_core_ftredge-1.5.0/src/ipulse_shared_core_ftredge/models/resource_catalog_item.py +189 -0
- ipulse_shared_core_ftredge-1.5.0/src/ipulse_shared_core_ftredge/models/user_profile.py +67 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0/src/ipulse_shared_core_ftredge.egg-info}/PKG-INFO +1 -1
- ipulse_shared_core_ftredge-1.3.0/src/ipulse_shared_core_ftredge/models/resource_catalog_item.py +0 -116
- ipulse_shared_core_ftredge-1.3.0/src/ipulse_shared_core_ftredge/models/user_profile.py +0 -151
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/LICENCE +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/README.md +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/pyproject.toml +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/setup.cfg +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/src/ipulse_shared_core_ftredge/__init__.py +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/src/ipulse_shared_core_ftredge/models/__init__.py +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/src/ipulse_shared_core_ftredge/models/audit_log_firestore.py +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/src/ipulse_shared_core_ftredge/models/organisation.py +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/src/ipulse_shared_core_ftredge/models/pulse_enums.py +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/src/ipulse_shared_core_ftredge/models/user_auth.py +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/src/ipulse_shared_core_ftredge/models/user_profile_update.py +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/src/ipulse_shared_core_ftredge.egg-info/SOURCES.txt +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/src/ipulse_shared_core_ftredge.egg-info/dependency_links.txt +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/src/ipulse_shared_core_ftredge.egg-info/requires.txt +0 -0
- {ipulse_shared_core_ftredge-1.3.0 → ipulse_shared_core_ftredge-1.5.0}/src/ipulse_shared_core_ftredge.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ipulse_shared_core_ftredge
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Shared models 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
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='ipulse_shared_core_ftredge',
|
|
5
|
-
version='1.
|
|
5
|
+
version='1.5.0',
|
|
6
6
|
package_dir={'': 'src'}, # Specify the source directory
|
|
7
7
|
packages=find_packages(where='src'), # Look for packages in 'src'
|
|
8
8
|
install_requires=[
|
ipulse_shared_core_ftredge-1.5.0/src/ipulse_shared_core_ftredge/models/resource_catalog_item.py
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from pydantic import BaseModel, validator, ValidationError
|
|
4
|
+
from typing import Dict, Any, Set, Optional
|
|
5
|
+
from . import pulse_enums as enums
|
|
6
|
+
|
|
7
|
+
import dateutil.parser
|
|
8
|
+
|
|
9
|
+
CLASS_VERSION = 1.0
|
|
10
|
+
CLASS_REF = "resdes"
|
|
11
|
+
MODULE = "core"
|
|
12
|
+
|
|
13
|
+
# metadata = {
|
|
14
|
+
# "resr_puid_or_name":"Users",
|
|
15
|
+
# "resr_path":"firestore/Users",
|
|
16
|
+
# "resr_name":"Users",
|
|
17
|
+
# "resr_pulse_module":MODULE,
|
|
18
|
+
# "resr_type":"firestore_collection",
|
|
19
|
+
# "resr_classifications":{ "auth_required_confidential"},
|
|
20
|
+
# "resr_contents":{"user_core_profile"},
|
|
21
|
+
# "resr_original_or_processed":"original_source",
|
|
22
|
+
# "resr_origin":"internal",
|
|
23
|
+
# "resr_origin_organisations_uids":{"20231220futureedgegroup_coreorgn"},
|
|
24
|
+
# }
|
|
25
|
+
|
|
26
|
+
# Annotated[str, {"resr_classification":"auth_required_restricted",
|
|
27
|
+
# "resr_readable_by": ["owner", "selected_by_admin"],
|
|
28
|
+
# "resr_updatable_by": ["admin"],
|
|
29
|
+
# "resr_original_or_processed" : "original_source",
|
|
30
|
+
# "resr_origin":"internal",
|
|
31
|
+
# "resr_origin_organisation_uids":["20231220futureedgegroup_coreorgn"],
|
|
32
|
+
# "resr_origin_description":"Original User field",
|
|
33
|
+
# "resr_creat_date":datetime(2023, 12, 23),
|
|
34
|
+
# "resr_creat_by_user":"Russlan Ramdowar;russlan@ftredge.com",
|
|
35
|
+
# "metadata_updt_date":datetime(2023, 12, 23),
|
|
36
|
+
# "metadata_updt_by_user":"Russlan Ramdowar;russlan@ftredge.com"}]
|
|
37
|
+
|
|
38
|
+
# metadata={"resr_classification":"auth_required_restricted",
|
|
39
|
+
# "resr_readable_by": ["owner", "selected_by_admin"],
|
|
40
|
+
# "resr_updatable_by": [],
|
|
41
|
+
# "resr_original_or_processed" : "original_source",
|
|
42
|
+
# "resr_origin":"internal",
|
|
43
|
+
# "resr_origin_organisation_uids":["20231220futureedgegroup_coreorgn"],
|
|
44
|
+
# "resr_origin_description":"Original User field",
|
|
45
|
+
# "resr_creat_date":datetime(2023, 12, 23),
|
|
46
|
+
# "resr_creat_by_user":"Russlan Ramdowar;russlan@ftredge.com",
|
|
47
|
+
# "metadata_updt_date":datetime(2023, 12, 23),
|
|
48
|
+
# "metadata_updt_by_user":"Russlan Ramdowar;russlan@ftredge.com"}
|
|
49
|
+
|
|
50
|
+
# metadata={"resr_classification":"auth_required_restricted",
|
|
51
|
+
# "resr_readable_by": ["owner", "selected_by_admin"],
|
|
52
|
+
# "resr_updatable_by": ["owner","admin"],
|
|
53
|
+
# "resr_original_or_processed" : "original_source",
|
|
54
|
+
# "resr_origin":"internal",
|
|
55
|
+
# "resr_origin_organisation_uids":["20231220futureedgegroup_coreorgn"],
|
|
56
|
+
# "resr_origin_description":"Original User field",
|
|
57
|
+
# "resr_creat_date":datetime(2023, 12, 23),
|
|
58
|
+
# "resr_creat_by_user":"Russlan Ramdowar;russlan@ftredge.com",
|
|
59
|
+
# "metadata_updt_date":datetime(2023, 12, 23),
|
|
60
|
+
# "metadata_updt_by_user":"Russlan Ramdowar;russlan@ftredge.com"}
|
|
61
|
+
|
|
62
|
+
# metadata={"resr_classification":"auth_required_confidential",
|
|
63
|
+
# "resr_readable_by": ["owner", "selected_by_admin"],
|
|
64
|
+
# "resr_updatable_by": ["admin"],
|
|
65
|
+
# "resr_original_or_processed" : "original_source",
|
|
66
|
+
# "resr_origin":"internal",
|
|
67
|
+
# "resr_origin_organisation_uids":["20231220futureedgegroup_coreorgn"],
|
|
68
|
+
# "resr_origin_description":"Original User field",
|
|
69
|
+
# "resr_creat_date":datetime(2023, 12, 23),
|
|
70
|
+
# "resr_creat_by_user":"Russlan Ramdowar",
|
|
71
|
+
# "metadata_updt_date":datetime(2023, 12, 23),
|
|
72
|
+
# "metadata_updt_by_user":"Russlan Ramdowar"}
|
|
73
|
+
|
|
74
|
+
# metadata={"resr_classification":"auth_required_confidential",
|
|
75
|
+
# "resr_readable_by": ["owner", "selected_by_admin"],
|
|
76
|
+
# "resr_updatable_by": ["selected_by_admin"],
|
|
77
|
+
# "resr_original_or_processed" : "original_source",
|
|
78
|
+
# "resr_origin":"internal",
|
|
79
|
+
# "resr_origin_organisation_uids":["20231220futureedgegroup_coreorgn"],
|
|
80
|
+
# "resr_origin_description":"Original User field",
|
|
81
|
+
# "resr_creat_date":datetime(2023, 12, 23),
|
|
82
|
+
# "resr_creat_by_user":"Russlan Ramdowar",
|
|
83
|
+
# "metadata_updt_date":datetime(2023, 12, 23),
|
|
84
|
+
# "metadata_updt_by_user":"Russlan Ramdowar"}
|
|
85
|
+
|
|
86
|
+
class ResourceCatalogItem(BaseModel):
|
|
87
|
+
|
|
88
|
+
resr_puid_or_name: str #Ex: username
|
|
89
|
+
resr_path: str #Ex: ipulse-401013/cloud/firesotre/Users/{user_uid}/username
|
|
90
|
+
resr_name: str #Ex: username
|
|
91
|
+
resr_pulse_module: str #Ex: core
|
|
92
|
+
resr_type: str
|
|
93
|
+
resr_classifications: Set[str]
|
|
94
|
+
resr_contents:Set[str]
|
|
95
|
+
resr_original_or_processed: str
|
|
96
|
+
resr_origin: str
|
|
97
|
+
resr_origin_organisations_uids: Set[str]
|
|
98
|
+
resr_origin_description: str
|
|
99
|
+
resr_licences_types: Set[str]
|
|
100
|
+
resr_description_details: str
|
|
101
|
+
resr_updtbl_by_non_staff: bool
|
|
102
|
+
resr_creat_by_user_uid: str
|
|
103
|
+
resr_creat_date: datetime
|
|
104
|
+
class_version:float = CLASS_VERSION
|
|
105
|
+
resr_columns_count: int
|
|
106
|
+
resr_columns: Optional[Dict[Any, Any]] = None #OPTIONAL
|
|
107
|
+
resr_structure_version: Optional[str]=None # OPTIONAL
|
|
108
|
+
resr_structure_updt_date: Optional[str]=None #OPTIONAL
|
|
109
|
+
resr_structure_updt_by_user_uid: Optional[str]=None # OPTIONAL
|
|
110
|
+
resr_tags: Optional[Dict[Any, Any]] = None #OPTIONAL
|
|
111
|
+
resr_content_updt_date: Optional[str]=None #OPTIONAL
|
|
112
|
+
resr_content_updt_by_user_uid: Optional[str]=None # OPTIONAL
|
|
113
|
+
puid: Optional[str] = None #TO BE SETUP BY Validator
|
|
114
|
+
metadata_version: Optional[float] = None #TO BE SETUP BY Validator
|
|
115
|
+
metadata_creat_date: Optional[datetime] = None #TO BE SETUP BY Management Service
|
|
116
|
+
metadata_creat_by: Optional[str] = None #TO BE SETUP BY Management Service
|
|
117
|
+
metadata_updt_date: Optional[datetime] = None #TO BE SETUP BY Management Service
|
|
118
|
+
metadata_updt_by: Optional[str] = None #TO BE SETUP BY Management Service
|
|
119
|
+
|
|
120
|
+
@validator('puid', pre=True, always=True)
|
|
121
|
+
def set_puid(cls, puid, values):
|
|
122
|
+
if puid is None:
|
|
123
|
+
return f"{datetime.utcnow().strftime('%Y%m%d%H%M')}{uuid.uuid4().hex[:8]}_{MODULE}{CLASS_REF}".lower()
|
|
124
|
+
return puid
|
|
125
|
+
|
|
126
|
+
@validator('metadata_version', pre=True, always=True)
|
|
127
|
+
def set_metadata_version(cls, metadata_version, values):
|
|
128
|
+
if metadata_version is None:
|
|
129
|
+
return 1.0
|
|
130
|
+
else:
|
|
131
|
+
return metadata_version + 0.1
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@validator('resr_pulse_module', pre=True, always=True)
|
|
135
|
+
def validate_resr_pulse_module(cls, resr_pulse_modules):
|
|
136
|
+
if resr_pulse_modules not in enums.pulse_modules:
|
|
137
|
+
raise ValueError("Invalid pulse_modules values provided.")
|
|
138
|
+
return resr_pulse_modules
|
|
139
|
+
|
|
140
|
+
@validator('resr_type', pre=True, always=True)
|
|
141
|
+
def validate_resr_type(cls, resr_type):
|
|
142
|
+
if resr_type not in enums.resource_types:
|
|
143
|
+
raise ValueError("Invalid resource_types value provided.")
|
|
144
|
+
return resr_type
|
|
145
|
+
|
|
146
|
+
@validator('resr_classifications', pre=True, always=True)
|
|
147
|
+
def validate_resr_classifications(cls, resr_classifications):
|
|
148
|
+
if not resr_classifications.issubset(enums.resource_classifications):
|
|
149
|
+
raise ValueError("Invalid resr_classifications values provided.")
|
|
150
|
+
return resr_classifications
|
|
151
|
+
|
|
152
|
+
@validator('resr_contents', pre=True, always=True)
|
|
153
|
+
def validate_resr_contents(cls, resr_contents):
|
|
154
|
+
if not resr_contents.issubset(enums.resource_contents):
|
|
155
|
+
raise ValueError("Invalid resr_contents values provided.")
|
|
156
|
+
return resr_contents
|
|
157
|
+
|
|
158
|
+
@validator('resr_original_or_processed', pre=True, always=True)
|
|
159
|
+
def validate_resr_original_or_processed(cls, resr_original_or_processed):
|
|
160
|
+
if resr_original_or_processed not in enums.resource_original_or_processed:
|
|
161
|
+
raise ValueError("Invalid resr_original_or_processed value provided.")
|
|
162
|
+
return resr_original_or_processed
|
|
163
|
+
|
|
164
|
+
@validator('resr_origin', pre=True, always=True)
|
|
165
|
+
def validate_resr_origin(cls, resr_origin):
|
|
166
|
+
if resr_origin not in enums.resource_origins:
|
|
167
|
+
raise ValueError("Invalid resource_origins value provided.")
|
|
168
|
+
return resr_origin
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
@validator('metadata_creat_date', 'metadata_updt_date', pre=True)
|
|
172
|
+
def parse_date(cls, value):
|
|
173
|
+
if value is None:
|
|
174
|
+
return value
|
|
175
|
+
if isinstance(value, datetime):
|
|
176
|
+
return value
|
|
177
|
+
try:
|
|
178
|
+
# Assuming Firestore returns an ISO 8601 string, adjust if necessary
|
|
179
|
+
return dateutil.parser.isoparse(value)
|
|
180
|
+
except (TypeError, ValueError):
|
|
181
|
+
raise ValidationError(f"Invalid datetime format inside Resource Description: {value}")
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
@validator('metadata_updt_date', 'metadata_updt_date', pre=True, always=True)
|
|
186
|
+
def set_default_updt_date(cls, date, values):
|
|
187
|
+
if date is None:
|
|
188
|
+
return datetime.utcnow().isoformat()
|
|
189
|
+
return date
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from pydantic import BaseModel, EmailStr , Field, root_validator
|
|
2
|
+
from datetime import datetime , date
|
|
3
|
+
from typing import Set, Optional, Dict, Any, Annotated
|
|
4
|
+
import uuid
|
|
5
|
+
from . import pulse_enums as enums
|
|
6
|
+
|
|
7
|
+
CLASS_VERSION = 2.1
|
|
8
|
+
CLASS_VERSION_AUTHOR="Russlan Ramdowar;russlan@ftredge.com"
|
|
9
|
+
CLASS_VERSION_DATE=datetime(2023, 12, 23, 17, 50)
|
|
10
|
+
MODULE="core"
|
|
11
|
+
CLASS_REF = "usrpf"
|
|
12
|
+
|
|
13
|
+
class UserProfile(BaseModel):
|
|
14
|
+
uid: str = Field(frozen=True, description="Generated by Firebase Auth")
|
|
15
|
+
|
|
16
|
+
puid:str = Field(default_factory=lambda: f"{datetime.utcnow().strftime('%Y%m%d%H%M')}{uuid.uuid4().hex[:8]}_{MODULE}{CLASS_REF}".lower(),
|
|
17
|
+
frozen=True,
|
|
18
|
+
description="Generated Automatically by default_factory")
|
|
19
|
+
email: EmailStr = Field(frozen=True, description="Propagated from Firebase Auth" )
|
|
20
|
+
insights_credits: int= Field(default_factory=lambda:7, description="Depends on Subscription Plan, Regularly Updated")
|
|
21
|
+
organizations_uids: Set[str] = Field( description="Depends on Subscription Plan, Regularly Updated")
|
|
22
|
+
creat_date: datetime #User can Read only
|
|
23
|
+
creat_by_user: str #User shouldn't see this or edit this_dump=
|
|
24
|
+
updt_date: datetime #User can Read only
|
|
25
|
+
updt_by_user: str #User shouldn't see this or edit this
|
|
26
|
+
approved: bool #User shouldn't see this or edit this
|
|
27
|
+
provider_id: str #User shouldn't see this or edit this
|
|
28
|
+
username: Optional[str] = None #User can Read and Edit
|
|
29
|
+
aliases: Optional[Set[str]] = None #User can Read and Edit
|
|
30
|
+
dob: Optional[date] = None #User can Read and Edit
|
|
31
|
+
first_name: Optional[str] = None #User can Read and Edit
|
|
32
|
+
last_name: Optional[str] = None #User can Read and Edit
|
|
33
|
+
mobile: Optional[str] = None #User can Read and Edit
|
|
34
|
+
groupes: Optional[Set[str]] = None #User can Read only
|
|
35
|
+
roles: Optional[Set[str]] = None #User can Read only
|
|
36
|
+
teams: Optional[Set[str]] = None #User can Read only
|
|
37
|
+
policies_uids: Optional[Set[str]] = None #User can Read only
|
|
38
|
+
subscription_plan_uid: Optional[str]=None #User can Read only
|
|
39
|
+
insights_credits_updated_since_datetime: Optional[datetime]=None #User can Read only
|
|
40
|
+
|
|
41
|
+
class Config:
|
|
42
|
+
extra = "forbid"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# class User(BaseModel):
|
|
46
|
+
# puid: str
|
|
47
|
+
# puid2:str #User can Read only
|
|
48
|
+
# email: EmailStr #User can Read only
|
|
49
|
+
# insights_credits: int=7 #User can Read only
|
|
50
|
+
# organizations_ids: Set[str] #User can Read only
|
|
51
|
+
# created_at: datetime #User can Read only
|
|
52
|
+
# created_by: str #User shouldn't see this or edit this
|
|
53
|
+
# updated_at: datetime #User can Read only
|
|
54
|
+
# updated_by: str #User shouldn't see this or edit this
|
|
55
|
+
# approved: bool #User shouldn't see this or edit this
|
|
56
|
+
# provider_id: str #User shouldn't see this or edit this
|
|
57
|
+
# username: Optional[str] = None #User can Read and Edit
|
|
58
|
+
# aliases: Optional[Set[str]] = None #User can Read and Edit
|
|
59
|
+
# dob: Optional[date] = None #User can Read and Edit
|
|
60
|
+
# first_name: Optional[str] = None #User can Read and Edit
|
|
61
|
+
# last_name: Optional[str] = None #User can Read and Edit
|
|
62
|
+
# mobile: Optional[str] = None #User can Read and Edit
|
|
63
|
+
# groups_names: Set[str] = None #User can Read only
|
|
64
|
+
# policies_uids: Optional[Set[str]] = None #User can Read only
|
|
65
|
+
# subscription_plan_uid: Optional[str]=None #User can Read only
|
|
66
|
+
# insights_credits_updated_since: Optional[datetime]=None #User can Read only
|
|
67
|
+
# class_version: float = CLASS_VERSION #User shouldn't see this or edit this
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ipulse_shared_core_ftredge
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Shared models 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
|
ipulse_shared_core_ftredge-1.3.0/src/ipulse_shared_core_ftredge/models/resource_catalog_item.py
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import uuid
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from pydantic import BaseModel, validator, ValidationError
|
|
4
|
-
from typing import Dict, Any, Set, Optional
|
|
5
|
-
from . import pulse_enums as enums
|
|
6
|
-
|
|
7
|
-
import dateutil.parser
|
|
8
|
-
|
|
9
|
-
CLASS_VERSION = 1.0
|
|
10
|
-
CLASS_REF = "resdes"
|
|
11
|
-
MODULE = "core"
|
|
12
|
-
|
|
13
|
-
class ResourceCatalogItem(BaseModel):
|
|
14
|
-
|
|
15
|
-
resr_puid_or_name: str #Ex: username
|
|
16
|
-
resr_path: str #Ex: ipulse-401013/cloud/firesotre/Users/{user_uid}/username
|
|
17
|
-
resr_name: str #Ex: username
|
|
18
|
-
resr_pulse_module: str = None #Ex: core
|
|
19
|
-
resr_type: str
|
|
20
|
-
resr_classifications: Set[str]
|
|
21
|
-
resr_contents:Set[str]
|
|
22
|
-
resr_original_or_processed: str
|
|
23
|
-
resr_origin: str
|
|
24
|
-
resr_origin_organisations_uids: Set[str]
|
|
25
|
-
resr_origin_description: str
|
|
26
|
-
resr_licences_types: Set[str]
|
|
27
|
-
resr_description_details: str
|
|
28
|
-
resr_updtbl_by_non_staff: bool
|
|
29
|
-
resr_creat_by_user_uid: str
|
|
30
|
-
resr_creat_date: datetime
|
|
31
|
-
class_version:float = CLASS_VERSION
|
|
32
|
-
resr_columns_count: int=None
|
|
33
|
-
resr_columns: Optional[Dict[Any, Any]] = None #OPTIONAL
|
|
34
|
-
resr_structure_version: Optional[str]=None # OPTIONAL
|
|
35
|
-
resr_structure_updt_date: Optional[str]=None #OPTIONAL
|
|
36
|
-
resr_structure_updt_by_user_uid: Optional[str]=None # OPTIONAL
|
|
37
|
-
resr_tags: Optional[Dict[Any, Any]] = None #OPTIONAL
|
|
38
|
-
resr_content_updt_date: Optional[str]=None #OPTIONAL
|
|
39
|
-
resr_content_updt_by_user_uid: Optional[str]=None # OPTIONAL
|
|
40
|
-
puid: str = None #TO BE SETUP BY Validator
|
|
41
|
-
metadata_version: float = None #TO BE SETUP BY Validator
|
|
42
|
-
metadata_creat_date: datetime = None #TO BE SETUP BY Management Service
|
|
43
|
-
metadata_creat_by: str = None #TO BE SETUP BY Management Service
|
|
44
|
-
metadata_updt_date: datetime = None #TO BE SETUP BY Management Service
|
|
45
|
-
metadata_updt_by: str = None #TO BE SETUP BY Management Service
|
|
46
|
-
|
|
47
|
-
@validator('puid', pre=True, always=True)
|
|
48
|
-
def set_puid(cls, puid, values):
|
|
49
|
-
if puid is None:
|
|
50
|
-
return f"{datetime.utcnow().strftime('%Y%m%d%H%M')}{uuid.uuid4().hex[:8]}_{MODULE}{CLASS_REF}".lower()
|
|
51
|
-
return puid
|
|
52
|
-
|
|
53
|
-
@validator('metadata_version', pre=True, always=True)
|
|
54
|
-
def set_metadata_version(cls, metadata_version, values):
|
|
55
|
-
if metadata_version is None:
|
|
56
|
-
return 1.0
|
|
57
|
-
else:
|
|
58
|
-
return metadata_version + 0.1
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
@validator('resr_pulse_module', pre=True, always=True)
|
|
62
|
-
def validate_resr_pulse_module(cls, resr_pulse_modules):
|
|
63
|
-
if resr_pulse_modules not in enums.pulse_modules:
|
|
64
|
-
raise ValueError("Invalid pulse_modules values provided.")
|
|
65
|
-
return resr_pulse_modules
|
|
66
|
-
|
|
67
|
-
@validator('resr_type', pre=True, always=True)
|
|
68
|
-
def validate_resr_type(cls, resr_type):
|
|
69
|
-
if resr_type not in enums.resource_types:
|
|
70
|
-
raise ValueError("Invalid resource_types value provided.")
|
|
71
|
-
return resr_type
|
|
72
|
-
|
|
73
|
-
@validator('resr_classifications', pre=True, always=True)
|
|
74
|
-
def validate_resr_classifications(cls, resr_classifications):
|
|
75
|
-
if not resr_classifications.issubset(enums.resource_classifications):
|
|
76
|
-
raise ValueError("Invalid resr_classifications values provided.")
|
|
77
|
-
return resr_classifications
|
|
78
|
-
|
|
79
|
-
@validator('resr_contents', pre=True, always=True)
|
|
80
|
-
def validate_resr_contents(cls, resr_contents):
|
|
81
|
-
if not resr_contents.issubset(enums.resource_contents):
|
|
82
|
-
raise ValueError("Invalid resr_contents values provided.")
|
|
83
|
-
return resr_contents
|
|
84
|
-
|
|
85
|
-
@validator('resr_original_or_processed', pre=True, always=True)
|
|
86
|
-
def validate_resr_original_or_processed(cls, resr_original_or_processed):
|
|
87
|
-
if resr_original_or_processed not in enums.resource_original_or_processed:
|
|
88
|
-
raise ValueError("Invalid resr_original_or_processed value provided.")
|
|
89
|
-
return resr_original_or_processed
|
|
90
|
-
|
|
91
|
-
@validator('resr_origin', pre=True, always=True)
|
|
92
|
-
def validate_resr_origin(cls, resr_origin):
|
|
93
|
-
if resr_origin not in enums.resource_origins:
|
|
94
|
-
raise ValueError("Invalid resource_origins value provided.")
|
|
95
|
-
return resr_origin
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
@validator('metadata_creat_date', 'metadata_updt_date', pre=True)
|
|
99
|
-
def parse_date(cls, value):
|
|
100
|
-
if value is None:
|
|
101
|
-
return value
|
|
102
|
-
if isinstance(value, datetime):
|
|
103
|
-
return value
|
|
104
|
-
try:
|
|
105
|
-
# Assuming Firestore returns an ISO 8601 string, adjust if necessary
|
|
106
|
-
return dateutil.parser.isoparse(value)
|
|
107
|
-
except (TypeError, ValueError):
|
|
108
|
-
raise ValidationError(f"Invalid datetime format inside Resource Description: {value}")
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
@validator('metadata_updt_date', 'metadata_updt_date', pre=True, always=True)
|
|
113
|
-
def set_default_updt_date(cls, date, values):
|
|
114
|
-
if date is None:
|
|
115
|
-
return datetime.utcnow().isoformat()
|
|
116
|
-
return date
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
from pydantic import BaseModel, EmailStr , Field, root_validator
|
|
2
|
-
from datetime import datetime , date
|
|
3
|
-
from typing import Set, Optional, Dict, Any, Annotated
|
|
4
|
-
import uuid
|
|
5
|
-
from . import pulse_enums as enums
|
|
6
|
-
|
|
7
|
-
CLASS_VERSION = 2.1
|
|
8
|
-
CLASS_VERSION_AUTHOR="Russlan Ramdowar;russlan@ftredge.com"
|
|
9
|
-
CLASS_VERSION_DATE=datetime(2023, 12, 23, 17, 50)
|
|
10
|
-
MODULE="core"
|
|
11
|
-
CLASS_REF = "usrpf"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class UserProfile(BaseModel):
|
|
15
|
-
uid: Annotated[str, {"resr_classification":"auth_required_restricted",
|
|
16
|
-
"resr_readable_by": ["owner", "selected_by_admin"],
|
|
17
|
-
"resr_updatable_by": ["admin"],
|
|
18
|
-
"resr_original_or_processed" : "original_source",
|
|
19
|
-
"resr_origin":"internal",
|
|
20
|
-
"resr_origin_organisation_uids":["20231220futureedgegroup_coreorgn"],
|
|
21
|
-
"resr_origin_description":"Original User field",
|
|
22
|
-
"resr_creat_date":datetime(2023, 12, 23),
|
|
23
|
-
"resr_creat_by_user":"Russlan Ramdowar;russlan@ftredge.com",
|
|
24
|
-
"metadata_updt_date":datetime(2023, 12, 23),
|
|
25
|
-
"metadata_updt_by_user":"Russlan Ramdowar;russlan@ftredge.com"}] = Field(frozen=True, description="Generated by Firebase Auth",
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
puid:str = Field(default_factory=lambda: f"{datetime.utcnow().strftime('%Y%m%d%H%M')}{uuid.uuid4().hex[:8]}_{MODULE}{CLASS_REF}".lower(),
|
|
29
|
-
frozen=True,
|
|
30
|
-
description="Generated Automatically by default_factory",
|
|
31
|
-
metadata={"resr_classification":"auth_required_restricted",
|
|
32
|
-
"resr_readable_by": ["owner", "selected_by_admin"],
|
|
33
|
-
"resr_updatable_by": [],
|
|
34
|
-
"resr_original_or_processed" : "original_source",
|
|
35
|
-
"resr_origin":"internal",
|
|
36
|
-
"resr_origin_organisation_uids":["20231220futureedgegroup_coreorgn"],
|
|
37
|
-
"resr_origin_description":"Original User field",
|
|
38
|
-
"resr_creat_date":datetime(2023, 12, 23),
|
|
39
|
-
"resr_creat_by_user":"Russlan Ramdowar;russlan@ftredge.com",
|
|
40
|
-
"metadata_updt_date":datetime(2023, 12, 23),
|
|
41
|
-
"metadata_updt_by_user":"Russlan Ramdowar;russlan@ftredge.com"})
|
|
42
|
-
email: EmailStr = Field(frozen=True,
|
|
43
|
-
description="Propagated from Firebase Auth",
|
|
44
|
-
metadata={"resr_classification":"auth_required_restricted",
|
|
45
|
-
"resr_readable_by": ["owner", "selected_by_admin"],
|
|
46
|
-
"resr_updatable_by": ["owner","admin"],
|
|
47
|
-
"resr_original_or_processed" : "original_source",
|
|
48
|
-
"resr_origin":"internal",
|
|
49
|
-
"resr_origin_organisation_uids":["20231220futureedgegroup_coreorgn"],
|
|
50
|
-
"resr_origin_description":"Original User field",
|
|
51
|
-
"resr_creat_date":datetime(2023, 12, 23),
|
|
52
|
-
"resr_creat_by_user":"Russlan Ramdowar;russlan@ftredge.com",
|
|
53
|
-
"metadata_updt_date":datetime(2023, 12, 23),
|
|
54
|
-
"metadata_updt_by_user":"Russlan Ramdowar;russlan@ftredge.com"})
|
|
55
|
-
insights_credits: int= Field(default_factory=lambda:7,
|
|
56
|
-
description="Depends on Subscription Plan, Regularly Updated",
|
|
57
|
-
metadata={"resr_classification":"auth_required_confidential",
|
|
58
|
-
"resr_readable_by": ["owner", "selected_by_admin"],
|
|
59
|
-
"resr_updatable_by": ["admin"],
|
|
60
|
-
"resr_original_or_processed" : "original_source",
|
|
61
|
-
"resr_origin":"internal",
|
|
62
|
-
"resr_origin_organisation_uids":["20231220futureedgegroup_coreorgn"],
|
|
63
|
-
"resr_origin_description":"Original User field",
|
|
64
|
-
"resr_creat_date":datetime(2023, 12, 23),
|
|
65
|
-
"resr_creat_by_user":"Russlan Ramdowar",
|
|
66
|
-
"metadata_updt_date":datetime(2023, 12, 23),
|
|
67
|
-
"metadata_updt_by_user":"Russlan Ramdowar"})
|
|
68
|
-
organizations_uids: Set[str] = Field(
|
|
69
|
-
description="Depends on Subscription Plan, Regularly Updated",
|
|
70
|
-
metadata={"resr_classification":"auth_required_confidential",
|
|
71
|
-
"resr_readable_by": ["owner", "selected_by_admin"],
|
|
72
|
-
"resr_updatable_by": ["selected_by_admin"],
|
|
73
|
-
"resr_original_or_processed" : "original_source",
|
|
74
|
-
"resr_origin":"internal",
|
|
75
|
-
"resr_origin_organisation_uids":["20231220futureedgegroup_coreorgn"],
|
|
76
|
-
"resr_origin_description":"Original User field",
|
|
77
|
-
"resr_creat_date":datetime(2023, 12, 23),
|
|
78
|
-
"resr_creat_by_user":"Russlan Ramdowar",
|
|
79
|
-
"metadata_updt_date":datetime(2023, 12, 23),
|
|
80
|
-
"metadata_updt_by_user":"Russlan Ramdowar"})
|
|
81
|
-
creat_date: datetime #User can Read only
|
|
82
|
-
creat_by_user: str #User shouldn't see this or edit this_dump=
|
|
83
|
-
updt_date: datetime #User can Read only
|
|
84
|
-
updt_by_user: str #User shouldn't see this or edit this
|
|
85
|
-
approved: bool #User shouldn't see this or edit this
|
|
86
|
-
provider_id: str #User shouldn't see this or edit this
|
|
87
|
-
username: Optional[str] = None #User can Read and Edit
|
|
88
|
-
aliases: Optional[Set[str]] = None #User can Read and Edit
|
|
89
|
-
dob: Optional[date] = None #User can Read and Edit
|
|
90
|
-
first_name: Optional[str] = None #User can Read and Edit
|
|
91
|
-
last_name: Optional[str] = None #User can Read and Edit
|
|
92
|
-
mobile: Optional[str] = None #User can Read and Edit
|
|
93
|
-
groups_names: Set[str] = None #User can Read only
|
|
94
|
-
policies_uids: Optional[Set[str]] = None #User can Read only
|
|
95
|
-
subscription_plan_uid: Optional[str]=None #User can Read only
|
|
96
|
-
insights_credits_updated_since: Optional[datetime]=None #User can Read only
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
class Config:
|
|
101
|
-
extra = "forbid"
|
|
102
|
-
# Custom metadata
|
|
103
|
-
metadata = {
|
|
104
|
-
"resr_puid_or_name":"Users",
|
|
105
|
-
"resr_path":"firestore/Users",
|
|
106
|
-
"resr_name":"Users",
|
|
107
|
-
"resr_pulse_module":MODULE,
|
|
108
|
-
"resr_type":"firestore_collection",
|
|
109
|
-
"resr_classifications":{ "auth_required_confidential"},
|
|
110
|
-
"resr_contents":{"user_core_profile"},
|
|
111
|
-
"resr_original_or_processed":"original_source",
|
|
112
|
-
"resr_origin":"internal",
|
|
113
|
-
"resr_origin_organisations_uids":{"20231220futureedgegroup_coreorgn"},
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
@root_validator(pre=True)
|
|
117
|
-
def check_resr_classification(cls, values: Dict[Any, Any]):
|
|
118
|
-
for field_name, field_value in values.items():
|
|
119
|
-
if field_name in cls.model_fields:
|
|
120
|
-
print(f"field_name : {field_name} , field_value : {field_value}")
|
|
121
|
-
# field_info = cls.model_fields[field_name].field_info
|
|
122
|
-
# resr_classification = field_info.extra.get("resr_classification")
|
|
123
|
-
# if resr_classification and resr_classification not in enums.resource_classifications:
|
|
124
|
-
# raise ValueError(f"Invalid resource_classification '{resr_classification}' for field '{field_name}'")
|
|
125
|
-
return values
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
# class User(BaseModel):
|
|
130
|
-
# puid: str
|
|
131
|
-
# puid2:str #User can Read only
|
|
132
|
-
# email: EmailStr #User can Read only
|
|
133
|
-
# insights_credits: int=7 #User can Read only
|
|
134
|
-
# organizations_ids: Set[str] #User can Read only
|
|
135
|
-
# created_at: datetime #User can Read only
|
|
136
|
-
# created_by: str #User shouldn't see this or edit this
|
|
137
|
-
# updated_at: datetime #User can Read only
|
|
138
|
-
# updated_by: str #User shouldn't see this or edit this
|
|
139
|
-
# approved: bool #User shouldn't see this or edit this
|
|
140
|
-
# provider_id: str #User shouldn't see this or edit this
|
|
141
|
-
# username: Optional[str] = None #User can Read and Edit
|
|
142
|
-
# aliases: Optional[Set[str]] = None #User can Read and Edit
|
|
143
|
-
# dob: Optional[date] = None #User can Read and Edit
|
|
144
|
-
# first_name: Optional[str] = None #User can Read and Edit
|
|
145
|
-
# last_name: Optional[str] = None #User can Read and Edit
|
|
146
|
-
# mobile: Optional[str] = None #User can Read and Edit
|
|
147
|
-
# groups_names: Set[str] = None #User can Read only
|
|
148
|
-
# policies_uids: Optional[Set[str]] = None #User can Read only
|
|
149
|
-
# subscription_plan_uid: Optional[str]=None #User can Read only
|
|
150
|
-
# insights_credits_updated_since: Optional[datetime]=None #User can Read only
|
|
151
|
-
# class_version: float = CLASS_VERSION #User shouldn't see this or edit this
|
|
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
|