maleo-identity 0.1.31__py3-none-any.whl → 0.1.59__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.
- maleo/identity/constants/api_key.py +1 -1
- maleo/identity/constants/organization.py +1 -1
- maleo/identity/constants/organization_registration_code.py +1 -1
- maleo/identity/constants/organization_relation.py +1 -1
- maleo/identity/constants/patient.py +1 -1
- maleo/identity/constants/user.py +1 -1
- maleo/identity/constants/user_medical_role.py +1 -1
- maleo/identity/constants/user_organization.py +13 -0
- maleo/identity/constants/user_organization_role.py +1 -1
- maleo/identity/constants/user_profile.py +2 -2
- maleo/identity/constants/user_system_role.py +2 -2
- maleo/identity/enums/api_key.py +1 -1
- maleo/identity/enums/organization.py +14 -10
- maleo/identity/enums/organization_registration_code.py +1 -1
- maleo/identity/enums/organization_relation.py +1 -1
- maleo/identity/enums/patient.py +1 -1
- maleo/identity/enums/user.py +16 -1
- maleo/identity/enums/user_medical_role.py +14 -1
- maleo/identity/enums/user_organization.py +40 -0
- maleo/identity/enums/user_organization_role.py +14 -1
- maleo/identity/enums/user_profile.py +1 -1
- maleo/identity/enums/user_system_role.py +1 -1
- maleo/identity/mixins/api_key.py +19 -3
- maleo/identity/mixins/common.py +2 -2
- maleo/identity/mixins/organization.py +10 -4
- maleo/identity/mixins/organization_registration_code.py +4 -4
- maleo/identity/mixins/organization_relation.py +5 -5
- maleo/identity/mixins/patient.py +2 -2
- maleo/identity/mixins/user.py +9 -3
- maleo/identity/mixins/user_medical_role.py +11 -5
- maleo/identity/mixins/user_organization.py +76 -0
- maleo/identity/mixins/user_organization_role.py +11 -5
- maleo/identity/mixins/user_profile.py +2 -2
- maleo/identity/mixins/user_system_role.py +3 -3
- maleo/identity/schemas/api_key.py +22 -8
- maleo/identity/schemas/common.py +26 -82
- maleo/identity/schemas/organization.py +59 -25
- maleo/identity/schemas/organization_registration_code.py +11 -11
- maleo/identity/schemas/organization_relation.py +48 -22
- maleo/identity/schemas/patient.py +12 -12
- maleo/identity/schemas/user.py +104 -22
- maleo/identity/schemas/user_medical_role.py +66 -16
- maleo/identity/schemas/user_organization.py +334 -0
- maleo/identity/schemas/user_organization_role.py +68 -16
- maleo/identity/schemas/user_profile.py +12 -12
- maleo/identity/schemas/user_system_role.py +10 -10
- maleo/identity/types/api_key.py +3 -2
- maleo/identity/types/organization.py +1 -1
- maleo/identity/types/organization_registration_code.py +1 -1
- maleo/identity/types/organization_relation.py +1 -1
- maleo/identity/types/user.py +1 -1
- maleo/identity/types/user_medical_role.py +3 -2
- maleo/identity/types/user_organization.py +7 -0
- maleo/identity/types/user_organization_role.py +3 -2
- maleo/identity/types/user_profile.py +1 -1
- maleo/identity/types/user_system_role.py +1 -1
- {maleo_identity-0.1.31.dist-info → maleo_identity-0.1.59.dist-info}/METADATA +10 -9
- maleo_identity-0.1.59.dist-info/RECORD +68 -0
- maleo/identity/utils/__init__.py +0 -0
- maleo/identity/utils/organization.py +0 -32
- maleo/identity/utils/user.py +0 -32
- maleo_identity-0.1.31.dist-info/RECORD +0 -66
- {maleo_identity-0.1.31.dist-info → maleo_identity-0.1.59.dist-info}/WHEEL +0 -0
- {maleo_identity-0.1.31.dist-info → maleo_identity-0.1.59.dist-info}/licenses/LICENSE +0 -0
- {maleo_identity-0.1.31.dist-info → maleo_identity-0.1.59.dist-info}/top_level.txt +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
from pydantic import BaseModel, Field
|
|
2
2
|
from typing import Annotated, Generic, Literal, TypeVar, overload
|
|
3
3
|
from uuid import UUID
|
|
4
|
-
from
|
|
4
|
+
from nexo.enums.organization import (
|
|
5
5
|
OrganizationRelation,
|
|
6
6
|
SimpleOrganizationRelationMixin,
|
|
7
7
|
OptListOfOrganizationRelations,
|
|
8
8
|
SimpleOrganizationRelationsMixin,
|
|
9
9
|
)
|
|
10
|
-
from
|
|
10
|
+
from nexo.enums.status import (
|
|
11
11
|
ListOfDataStatuses,
|
|
12
12
|
FULL_DATA_STATUSES,
|
|
13
13
|
)
|
|
14
|
-
from
|
|
15
|
-
from
|
|
14
|
+
from nexo.schemas.mixins.filter import convert as convert_filter
|
|
15
|
+
from nexo.schemas.mixins.identity import (
|
|
16
16
|
IdentifierMixin,
|
|
17
17
|
Ids,
|
|
18
18
|
UUIDs,
|
|
@@ -21,18 +21,18 @@ from maleo.schemas.mixins.identity import (
|
|
|
21
21
|
IntTargetId,
|
|
22
22
|
IntTargetIds,
|
|
23
23
|
)
|
|
24
|
-
from
|
|
25
|
-
from
|
|
26
|
-
from
|
|
24
|
+
from nexo.schemas.mixins.sort import convert as convert_sort
|
|
25
|
+
from nexo.schemas.operation.enums import ResourceOperationStatusUpdateType
|
|
26
|
+
from nexo.schemas.parameter import (
|
|
27
27
|
ReadSingleParameter as BaseReadSingleParameter,
|
|
28
28
|
ReadPaginatedMultipleParameter,
|
|
29
29
|
StatusUpdateParameter as BaseStatusUpdateParameter,
|
|
30
30
|
DeleteSingleParameter as BaseDeleteSingleParameter,
|
|
31
31
|
)
|
|
32
|
-
from
|
|
33
|
-
from
|
|
34
|
-
from
|
|
35
|
-
from
|
|
32
|
+
from nexo.types.boolean import OptBool
|
|
33
|
+
from nexo.types.dict import StrToAnyDict
|
|
34
|
+
from nexo.types.integer import OptListOfInts
|
|
35
|
+
from nexo.types.uuid import OptListOfUUIDs
|
|
36
36
|
from ..enums.organization_relation import IdentifierType, OptListOfExpandableFields
|
|
37
37
|
from ..mixins.organization_relation import (
|
|
38
38
|
IsBidirectional,
|
|
@@ -43,24 +43,48 @@ from ..mixins.organization_relation import (
|
|
|
43
43
|
from ..types.organization_relation import CompositeIdentifierType, IdentifierValueType
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
class
|
|
47
|
-
Expand,
|
|
46
|
+
class BareCreateData(
|
|
48
47
|
Meta,
|
|
49
48
|
IsBidirectional[bool],
|
|
50
|
-
SimpleOrganizationRelationMixin[OrganizationRelation],
|
|
51
|
-
IntTargetId[int],
|
|
52
|
-
IntSourceId[int],
|
|
53
49
|
):
|
|
54
50
|
is_bidirectional: Annotated[bool, Field(False, description="Is Bidirectional")] = (
|
|
55
51
|
False
|
|
56
52
|
)
|
|
57
53
|
|
|
58
54
|
|
|
55
|
+
class BaseCreateData(
|
|
56
|
+
BareCreateData,
|
|
57
|
+
SimpleOrganizationRelationMixin[OrganizationRelation],
|
|
58
|
+
):
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class SimpleCreateData(
|
|
63
|
+
BaseCreateData,
|
|
64
|
+
IntTargetId[int],
|
|
65
|
+
):
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class FullCreateData(
|
|
70
|
+
SimpleCreateData,
|
|
71
|
+
IntSourceId[int],
|
|
72
|
+
):
|
|
73
|
+
pass
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class CreateParameter(
|
|
77
|
+
Expand,
|
|
78
|
+
FullCreateData,
|
|
79
|
+
):
|
|
80
|
+
pass
|
|
81
|
+
|
|
82
|
+
|
|
59
83
|
class ReadMultipleParameter(
|
|
60
84
|
Expand,
|
|
61
85
|
ReadPaginatedMultipleParameter,
|
|
62
|
-
SimpleOrganizationRelationsMixin[OptListOfOrganizationRelations],
|
|
63
86
|
IsBidirectional[OptBool],
|
|
87
|
+
SimpleOrganizationRelationsMixin[OptListOfOrganizationRelations],
|
|
64
88
|
IntTargetIds[OptListOfInts],
|
|
65
89
|
IntSourceIds[OptListOfInts],
|
|
66
90
|
UUIDs[OptListOfUUIDs],
|
|
@@ -70,13 +94,13 @@ class ReadMultipleParameter(
|
|
|
70
94
|
uuids: Annotated[OptListOfUUIDs, Field(None, description="UUIDs")] = None
|
|
71
95
|
source_ids: Annotated[OptListOfInts, Field(None, description="Source's IDs")] = None
|
|
72
96
|
target_ids: Annotated[OptListOfInts, Field(None, description="Target's IDs")] = None
|
|
73
|
-
is_bidirectional: Annotated[
|
|
74
|
-
OptBool, Field(None, description="Whether is bidirectional")
|
|
75
|
-
] = None
|
|
76
97
|
relations: Annotated[
|
|
77
98
|
OptListOfOrganizationRelations,
|
|
78
99
|
Field(None, description="Organization Relations"),
|
|
79
100
|
] = None
|
|
101
|
+
is_bidirectional: Annotated[
|
|
102
|
+
OptBool, Field(None, description="Whether is bidirectional")
|
|
103
|
+
] = None
|
|
80
104
|
|
|
81
105
|
@property
|
|
82
106
|
def _query_param_fields(self) -> set[str]:
|
|
@@ -185,11 +209,13 @@ class ReadSingleParameter(
|
|
|
185
209
|
|
|
186
210
|
|
|
187
211
|
class FullUpdateData(Meta, IsBidirectional[bool]):
|
|
188
|
-
|
|
212
|
+
is_bidirectional: Annotated[bool, Field(..., description="Is Bidirectional")]
|
|
189
213
|
|
|
190
214
|
|
|
191
215
|
class PartialUpdateData(Meta, IsBidirectional[OptBool]):
|
|
192
|
-
|
|
216
|
+
is_bidirectional: Annotated[
|
|
217
|
+
OptBool, Field(None, description="Is Bidirectional")
|
|
218
|
+
] = None
|
|
193
219
|
|
|
194
220
|
|
|
195
221
|
UpdateDataT = TypeVar("UpdateDataT", FullUpdateData, PartialUpdateData)
|
|
@@ -2,7 +2,7 @@ from datetime import date
|
|
|
2
2
|
from pydantic import BaseModel, Field
|
|
3
3
|
from typing import Annotated, Generic, Literal, TypeVar, overload
|
|
4
4
|
from uuid import UUID
|
|
5
|
-
from
|
|
5
|
+
from nexo.enums.identity import (
|
|
6
6
|
OptBloodType,
|
|
7
7
|
BloodTypeMixin,
|
|
8
8
|
OptListOfBloodTypes,
|
|
@@ -17,12 +17,12 @@ from maleo.enums.identity import (
|
|
|
17
17
|
OptListOfGenders,
|
|
18
18
|
GendersMixin,
|
|
19
19
|
)
|
|
20
|
-
from
|
|
20
|
+
from nexo.enums.status import (
|
|
21
21
|
ListOfDataStatuses,
|
|
22
22
|
FULL_DATA_STATUSES,
|
|
23
23
|
)
|
|
24
|
-
from
|
|
25
|
-
from
|
|
24
|
+
from nexo.schemas.mixins.filter import convert as convert_filter
|
|
25
|
+
from nexo.schemas.mixins.identity import (
|
|
26
26
|
IdentifierMixin,
|
|
27
27
|
Ids,
|
|
28
28
|
UUIDs,
|
|
@@ -33,19 +33,19 @@ from maleo.schemas.mixins.identity import (
|
|
|
33
33
|
IntOrganizationId,
|
|
34
34
|
IntOrganizationIds,
|
|
35
35
|
)
|
|
36
|
-
from
|
|
37
|
-
from
|
|
38
|
-
from
|
|
36
|
+
from nexo.schemas.mixins.sort import convert as convert_sort
|
|
37
|
+
from nexo.schemas.operation.enums import ResourceOperationStatusUpdateType
|
|
38
|
+
from nexo.schemas.parameter import (
|
|
39
39
|
ReadSingleParameter as BaseReadSingleParameter,
|
|
40
40
|
ReadPaginatedMultipleParameter,
|
|
41
41
|
StatusUpdateParameter as BaseStatusUpdateParameter,
|
|
42
42
|
DeleteSingleParameter as BaseDeleteSingleParameter,
|
|
43
43
|
)
|
|
44
|
-
from
|
|
45
|
-
from
|
|
46
|
-
from
|
|
47
|
-
from
|
|
48
|
-
from
|
|
44
|
+
from nexo.types.datetime import OptDate
|
|
45
|
+
from nexo.types.dict import StrToAnyDict
|
|
46
|
+
from nexo.types.integer import OptListOfInts
|
|
47
|
+
from nexo.types.string import OptStr, OptListOfStrs
|
|
48
|
+
from nexo.types.uuid import OptListOfUUIDs
|
|
49
49
|
from ..enums.patient import IdentifierType, OptListOfExpandableFields
|
|
50
50
|
from ..mixins.common import IdCard, FullName, PlaceOfBirth
|
|
51
51
|
from ..mixins.patient import PatientIdentity, PatientIdentifier, Expand
|
maleo/identity/schemas/user.py
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
from typing import Annotated, Generic, Literal, TypeVar, overload
|
|
1
|
+
from pydantic import BaseModel, Field, model_validator
|
|
2
|
+
from typing import Annotated, Generic, Literal, Self, TypeVar, overload
|
|
3
3
|
from uuid import UUID
|
|
4
|
-
from
|
|
4
|
+
from nexo.enums.status import (
|
|
5
5
|
ListOfDataStatuses,
|
|
6
6
|
FULL_DATA_STATUSES,
|
|
7
7
|
)
|
|
8
|
-
from
|
|
8
|
+
from nexo.enums.user import (
|
|
9
9
|
UserType,
|
|
10
10
|
OptUserType,
|
|
11
11
|
FullUserTypeMixin,
|
|
12
12
|
OptListOfUserTypes,
|
|
13
13
|
FullUserTypesMixin,
|
|
14
14
|
)
|
|
15
|
-
from
|
|
16
|
-
from
|
|
15
|
+
from nexo.schemas.error.enums import ErrorCode
|
|
16
|
+
from nexo.schemas.mixins.filter import convert as convert_filter
|
|
17
|
+
from nexo.schemas.mixins.identity import (
|
|
17
18
|
IdentifierMixin,
|
|
18
19
|
Ids,
|
|
19
20
|
UUIDs,
|
|
20
21
|
IntOrganizationIds,
|
|
21
22
|
)
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
23
|
+
from nexo.schemas.mixins.parameter import IncludeURL
|
|
24
|
+
from nexo.schemas.mixins.sort import convert as convert_sort
|
|
25
|
+
from nexo.schemas.operation.enums import ResourceOperationStatusUpdateType
|
|
26
|
+
from nexo.schemas.parameter import (
|
|
25
27
|
ReadSingleParameter as BaseReadSingleParameter,
|
|
26
28
|
ReadPaginatedMultipleParameter,
|
|
27
29
|
StatusUpdateParameter as BaseStatusUpdateParameter,
|
|
28
30
|
DeleteSingleParameter as BaseDeleteSingleParameter,
|
|
29
31
|
)
|
|
30
|
-
from
|
|
31
|
-
from
|
|
32
|
-
from
|
|
33
|
-
from
|
|
34
|
-
from ..enums.user import IdentifierType
|
|
32
|
+
from nexo.types.dict import StrToAnyDict
|
|
33
|
+
from nexo.types.integer import OptListOfInts
|
|
34
|
+
from nexo.types.string import OptStr, OptListOfStrs
|
|
35
|
+
from nexo.types.uuid import OptListOfUUIDs
|
|
36
|
+
from ..enums.user import IdentifierType, OptListOfExpandableFields
|
|
35
37
|
from ..mixins.user import (
|
|
36
38
|
Username,
|
|
37
39
|
Usernames,
|
|
@@ -39,18 +41,26 @@ from ..mixins.user import (
|
|
|
39
41
|
Emails,
|
|
40
42
|
Phone,
|
|
41
43
|
Phones,
|
|
44
|
+
Password,
|
|
45
|
+
Expand,
|
|
42
46
|
UserIdentifier,
|
|
43
47
|
)
|
|
44
48
|
from ..types.user import IdentifierValueType
|
|
45
49
|
|
|
46
50
|
|
|
47
|
-
class
|
|
48
|
-
Phone[str], Email[str], Username[str], FullUserTypeMixin[UserType]
|
|
51
|
+
class CreateData(
|
|
52
|
+
Password, Phone[str], Email[str], Username[str], FullUserTypeMixin[UserType]
|
|
49
53
|
):
|
|
50
54
|
pass
|
|
51
55
|
|
|
52
56
|
|
|
57
|
+
class CreateParameter(Expand, CreateData):
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
|
|
53
61
|
class ReadMultipleParameter(
|
|
62
|
+
IncludeURL,
|
|
63
|
+
Expand,
|
|
54
64
|
ReadPaginatedMultipleParameter,
|
|
55
65
|
Phones[OptListOfStrs],
|
|
56
66
|
Emails[OptListOfStrs],
|
|
@@ -89,6 +99,8 @@ class ReadMultipleParameter(
|
|
|
89
99
|
"page",
|
|
90
100
|
"limit",
|
|
91
101
|
"use_cache",
|
|
102
|
+
"expand",
|
|
103
|
+
"include_url",
|
|
92
104
|
}
|
|
93
105
|
|
|
94
106
|
def to_query_params(self) -> StrToAnyDict:
|
|
@@ -101,15 +113,23 @@ class ReadMultipleParameter(
|
|
|
101
113
|
return params
|
|
102
114
|
|
|
103
115
|
|
|
104
|
-
class ReadSingleParameter(BaseReadSingleParameter[UserIdentifier]):
|
|
116
|
+
class ReadSingleParameter(IncludeURL, Expand, BaseReadSingleParameter[UserIdentifier]):
|
|
105
117
|
@classmethod
|
|
106
118
|
def from_identifier(
|
|
107
119
|
cls,
|
|
108
120
|
identifier: UserIdentifier,
|
|
109
121
|
statuses: ListOfDataStatuses = FULL_DATA_STATUSES,
|
|
110
122
|
use_cache: bool = True,
|
|
123
|
+
expand: OptListOfExpandableFields = None,
|
|
124
|
+
include_url: bool = False,
|
|
111
125
|
) -> "ReadSingleParameter":
|
|
112
|
-
return cls(
|
|
126
|
+
return cls(
|
|
127
|
+
identifier=identifier,
|
|
128
|
+
statuses=statuses,
|
|
129
|
+
use_cache=use_cache,
|
|
130
|
+
expand=expand,
|
|
131
|
+
include_url=include_url,
|
|
132
|
+
)
|
|
113
133
|
|
|
114
134
|
@overload
|
|
115
135
|
@classmethod
|
|
@@ -119,6 +139,8 @@ class ReadSingleParameter(BaseReadSingleParameter[UserIdentifier]):
|
|
|
119
139
|
identifier_value: int,
|
|
120
140
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
121
141
|
use_cache: bool = True,
|
|
142
|
+
expand: OptListOfExpandableFields = None,
|
|
143
|
+
include_url: bool = False,
|
|
122
144
|
) -> "ReadSingleParameter": ...
|
|
123
145
|
@overload
|
|
124
146
|
@classmethod
|
|
@@ -128,6 +150,8 @@ class ReadSingleParameter(BaseReadSingleParameter[UserIdentifier]):
|
|
|
128
150
|
identifier_value: UUID,
|
|
129
151
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
130
152
|
use_cache: bool = True,
|
|
153
|
+
expand: OptListOfExpandableFields = None,
|
|
154
|
+
include_url: bool = False,
|
|
131
155
|
) -> "ReadSingleParameter": ...
|
|
132
156
|
@overload
|
|
133
157
|
@classmethod
|
|
@@ -137,7 +161,10 @@ class ReadSingleParameter(BaseReadSingleParameter[UserIdentifier]):
|
|
|
137
161
|
identifier_value: str,
|
|
138
162
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
139
163
|
use_cache: bool = True,
|
|
164
|
+
expand: OptListOfExpandableFields = None,
|
|
165
|
+
include_url: bool = False,
|
|
140
166
|
) -> "ReadSingleParameter": ...
|
|
167
|
+
@overload
|
|
141
168
|
@classmethod
|
|
142
169
|
def new(
|
|
143
170
|
cls,
|
|
@@ -145,6 +172,18 @@ class ReadSingleParameter(BaseReadSingleParameter[UserIdentifier]):
|
|
|
145
172
|
identifier_value: IdentifierValueType,
|
|
146
173
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
147
174
|
use_cache: bool = True,
|
|
175
|
+
expand: OptListOfExpandableFields = None,
|
|
176
|
+
include_url: bool = False,
|
|
177
|
+
) -> "ReadSingleParameter": ...
|
|
178
|
+
@classmethod
|
|
179
|
+
def new(
|
|
180
|
+
cls,
|
|
181
|
+
identifier_type: IdentifierType,
|
|
182
|
+
identifier_value: IdentifierValueType,
|
|
183
|
+
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
184
|
+
use_cache: bool = True,
|
|
185
|
+
expand: OptListOfExpandableFields = None,
|
|
186
|
+
include_url: bool = False,
|
|
148
187
|
) -> "ReadSingleParameter":
|
|
149
188
|
return cls(
|
|
150
189
|
identifier=UserIdentifier(
|
|
@@ -153,20 +192,33 @@ class ReadSingleParameter(BaseReadSingleParameter[UserIdentifier]):
|
|
|
153
192
|
),
|
|
154
193
|
statuses=statuses,
|
|
155
194
|
use_cache=use_cache,
|
|
195
|
+
expand=expand,
|
|
196
|
+
include_url=include_url,
|
|
156
197
|
)
|
|
157
198
|
|
|
158
199
|
def to_query_params(self) -> StrToAnyDict:
|
|
159
200
|
return self.model_dump(
|
|
160
|
-
mode="json",
|
|
201
|
+
mode="json",
|
|
202
|
+
include={"statuses", "use_cache", "expand", "include_url"},
|
|
203
|
+
exclude_none=True,
|
|
161
204
|
)
|
|
162
205
|
|
|
163
206
|
|
|
164
207
|
class PasswordUpdateData(BaseModel):
|
|
165
|
-
|
|
208
|
+
old_password: Annotated[str, Field(..., description="Old Password", max_length=255)]
|
|
166
209
|
old_confirmation: Annotated[
|
|
167
210
|
str, Field(..., description="Old Password Confirmation", max_length=255)
|
|
168
211
|
]
|
|
169
|
-
|
|
212
|
+
new_password: Annotated[str, Field(..., description="New Password", max_length=255)]
|
|
213
|
+
|
|
214
|
+
@model_validator(mode="after")
|
|
215
|
+
def validate_old_and_confirmation(self) -> Self:
|
|
216
|
+
if self.old_password != self.old_confirmation:
|
|
217
|
+
raise ValueError(
|
|
218
|
+
ErrorCode.BAD_REQUEST,
|
|
219
|
+
"Old password must be the same with the confirmation",
|
|
220
|
+
)
|
|
221
|
+
return self
|
|
170
222
|
|
|
171
223
|
|
|
172
224
|
class FullUpdateData(
|
|
@@ -181,7 +233,9 @@ class PartialUpdateData(
|
|
|
181
233
|
pass
|
|
182
234
|
|
|
183
235
|
|
|
184
|
-
UpdateDataT = TypeVar(
|
|
236
|
+
UpdateDataT = TypeVar(
|
|
237
|
+
"UpdateDataT", FullUpdateData, PartialUpdateData, PasswordUpdateData
|
|
238
|
+
)
|
|
185
239
|
|
|
186
240
|
|
|
187
241
|
class UpdateDataMixin(BaseModel, Generic[UpdateDataT]):
|
|
@@ -189,6 +243,8 @@ class UpdateDataMixin(BaseModel, Generic[UpdateDataT]):
|
|
|
189
243
|
|
|
190
244
|
|
|
191
245
|
class UpdateParameter(
|
|
246
|
+
IncludeURL,
|
|
247
|
+
Expand,
|
|
192
248
|
UpdateDataMixin[UpdateDataT],
|
|
193
249
|
IdentifierMixin[UserIdentifier],
|
|
194
250
|
Generic[UpdateDataT],
|
|
@@ -200,6 +256,8 @@ class UpdateParameter(
|
|
|
200
256
|
identifier_type: Literal[IdentifierType.ID],
|
|
201
257
|
identifier_value: int,
|
|
202
258
|
data: UpdateDataT,
|
|
259
|
+
expand: OptListOfExpandableFields = None,
|
|
260
|
+
include_url: bool = False,
|
|
203
261
|
) -> "UpdateParameter": ...
|
|
204
262
|
@overload
|
|
205
263
|
@classmethod
|
|
@@ -208,6 +266,8 @@ class UpdateParameter(
|
|
|
208
266
|
identifier_type: Literal[IdentifierType.UUID],
|
|
209
267
|
identifier_value: UUID,
|
|
210
268
|
data: UpdateDataT,
|
|
269
|
+
expand: OptListOfExpandableFields = None,
|
|
270
|
+
include_url: bool = False,
|
|
211
271
|
) -> "UpdateParameter": ...
|
|
212
272
|
@overload
|
|
213
273
|
@classmethod
|
|
@@ -216,6 +276,8 @@ class UpdateParameter(
|
|
|
216
276
|
identifier_type: Literal[IdentifierType.USERNAME, IdentifierType.EMAIL],
|
|
217
277
|
identifier_value: str,
|
|
218
278
|
data: UpdateDataT,
|
|
279
|
+
expand: OptListOfExpandableFields = None,
|
|
280
|
+
include_url: bool = False,
|
|
219
281
|
) -> "UpdateParameter": ...
|
|
220
282
|
@overload
|
|
221
283
|
@classmethod
|
|
@@ -224,6 +286,8 @@ class UpdateParameter(
|
|
|
224
286
|
identifier_type: IdentifierType,
|
|
225
287
|
identifier_value: IdentifierValueType,
|
|
226
288
|
data: UpdateDataT,
|
|
289
|
+
expand: OptListOfExpandableFields = None,
|
|
290
|
+
include_url: bool = False,
|
|
227
291
|
) -> "UpdateParameter": ...
|
|
228
292
|
@classmethod
|
|
229
293
|
def new(
|
|
@@ -231,14 +295,20 @@ class UpdateParameter(
|
|
|
231
295
|
identifier_type: IdentifierType,
|
|
232
296
|
identifier_value: IdentifierValueType,
|
|
233
297
|
data: UpdateDataT,
|
|
298
|
+
expand: OptListOfExpandableFields = None,
|
|
299
|
+
include_url: bool = False,
|
|
234
300
|
) -> "UpdateParameter":
|
|
235
301
|
return cls(
|
|
236
302
|
identifier=UserIdentifier(type=identifier_type, value=identifier_value),
|
|
237
303
|
data=data,
|
|
304
|
+
expand=expand,
|
|
305
|
+
include_url=include_url,
|
|
238
306
|
)
|
|
239
307
|
|
|
240
308
|
|
|
241
309
|
class StatusUpdateParameter(
|
|
310
|
+
IncludeURL,
|
|
311
|
+
Expand,
|
|
242
312
|
BaseStatusUpdateParameter[UserIdentifier],
|
|
243
313
|
):
|
|
244
314
|
@overload
|
|
@@ -248,6 +318,8 @@ class StatusUpdateParameter(
|
|
|
248
318
|
identifier_type: Literal[IdentifierType.ID],
|
|
249
319
|
identifier_value: int,
|
|
250
320
|
type: ResourceOperationStatusUpdateType,
|
|
321
|
+
expand: OptListOfExpandableFields = None,
|
|
322
|
+
include_url: bool = False,
|
|
251
323
|
) -> "StatusUpdateParameter": ...
|
|
252
324
|
@overload
|
|
253
325
|
@classmethod
|
|
@@ -256,6 +328,8 @@ class StatusUpdateParameter(
|
|
|
256
328
|
identifier_type: Literal[IdentifierType.UUID],
|
|
257
329
|
identifier_value: UUID,
|
|
258
330
|
type: ResourceOperationStatusUpdateType,
|
|
331
|
+
expand: OptListOfExpandableFields = None,
|
|
332
|
+
include_url: bool = False,
|
|
259
333
|
) -> "StatusUpdateParameter": ...
|
|
260
334
|
@overload
|
|
261
335
|
@classmethod
|
|
@@ -264,6 +338,8 @@ class StatusUpdateParameter(
|
|
|
264
338
|
identifier_type: Literal[IdentifierType.USERNAME, IdentifierType.EMAIL],
|
|
265
339
|
identifier_value: str,
|
|
266
340
|
type: ResourceOperationStatusUpdateType,
|
|
341
|
+
expand: OptListOfExpandableFields = None,
|
|
342
|
+
include_url: bool = False,
|
|
267
343
|
) -> "StatusUpdateParameter": ...
|
|
268
344
|
@overload
|
|
269
345
|
@classmethod
|
|
@@ -272,6 +348,8 @@ class StatusUpdateParameter(
|
|
|
272
348
|
identifier_type: IdentifierType,
|
|
273
349
|
identifier_value: IdentifierValueType,
|
|
274
350
|
type: ResourceOperationStatusUpdateType,
|
|
351
|
+
expand: OptListOfExpandableFields = None,
|
|
352
|
+
include_url: bool = False,
|
|
275
353
|
) -> "StatusUpdateParameter": ...
|
|
276
354
|
@classmethod
|
|
277
355
|
def new(
|
|
@@ -279,10 +357,14 @@ class StatusUpdateParameter(
|
|
|
279
357
|
identifier_type: IdentifierType,
|
|
280
358
|
identifier_value: IdentifierValueType,
|
|
281
359
|
type: ResourceOperationStatusUpdateType,
|
|
360
|
+
expand: OptListOfExpandableFields = None,
|
|
361
|
+
include_url: bool = False,
|
|
282
362
|
) -> "StatusUpdateParameter":
|
|
283
363
|
return cls(
|
|
284
364
|
identifier=UserIdentifier(type=identifier_type, value=identifier_value),
|
|
285
365
|
type=type,
|
|
366
|
+
expand=expand,
|
|
367
|
+
include_url=include_url,
|
|
286
368
|
)
|
|
287
369
|
|
|
288
370
|
|