maleo-foundation 0.3.45__py3-none-any.whl → 0.3.47__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_foundation/authentication.py +24 -13
- maleo_foundation/authorization.py +2 -1
- maleo_foundation/client/manager.py +22 -21
- maleo_foundation/client/services/__init__.py +16 -7
- maleo_foundation/client/services/encryption/__init__.py +13 -4
- maleo_foundation/client/services/encryption/aes.py +41 -36
- maleo_foundation/client/services/encryption/rsa.py +50 -50
- maleo_foundation/client/services/hash/__init__.py +19 -6
- maleo_foundation/client/services/hash/bcrypt.py +20 -18
- maleo_foundation/client/services/hash/hmac.py +20 -17
- maleo_foundation/client/services/hash/sha256.py +18 -15
- maleo_foundation/client/services/key.py +50 -42
- maleo_foundation/client/services/signature.py +46 -42
- maleo_foundation/client/services/token.py +49 -58
- maleo_foundation/constants.py +13 -14
- maleo_foundation/enums.py +14 -13
- maleo_foundation/expanded_types/__init__.py +2 -3
- maleo_foundation/expanded_types/client.py +30 -34
- maleo_foundation/expanded_types/encryption/__init__.py +2 -1
- maleo_foundation/expanded_types/encryption/aes.py +7 -5
- maleo_foundation/expanded_types/encryption/rsa.py +7 -5
- maleo_foundation/expanded_types/general.py +13 -11
- maleo_foundation/expanded_types/hash.py +7 -5
- maleo_foundation/expanded_types/key.py +8 -6
- maleo_foundation/expanded_types/service.py +30 -34
- maleo_foundation/expanded_types/signature.py +7 -5
- maleo_foundation/expanded_types/token.py +7 -5
- maleo_foundation/extended_types.py +4 -3
- maleo_foundation/managers/cache.py +2 -1
- maleo_foundation/managers/client/base.py +25 -12
- maleo_foundation/managers/client/google/base.py +11 -4
- maleo_foundation/managers/client/google/parameter.py +9 -11
- maleo_foundation/managers/client/google/secret.py +53 -35
- maleo_foundation/managers/client/google/storage.py +52 -22
- maleo_foundation/managers/client/google/subscription.py +37 -39
- maleo_foundation/managers/client/maleo.py +18 -23
- maleo_foundation/managers/configuration.py +5 -9
- maleo_foundation/managers/credential.py +14 -17
- maleo_foundation/managers/db.py +51 -40
- maleo_foundation/managers/middleware.py +9 -9
- maleo_foundation/managers/service.py +47 -54
- maleo_foundation/middlewares/authentication.py +29 -54
- maleo_foundation/middlewares/base.py +83 -72
- maleo_foundation/middlewares/cors.py +8 -7
- maleo_foundation/models/__init__.py +2 -1
- maleo_foundation/models/responses.py +57 -29
- maleo_foundation/models/schemas/__init__.py +2 -1
- maleo_foundation/models/schemas/encryption.py +5 -2
- maleo_foundation/models/schemas/general.py +38 -18
- maleo_foundation/models/schemas/hash.py +2 -1
- maleo_foundation/models/schemas/key.py +5 -2
- maleo_foundation/models/schemas/parameter.py +45 -15
- maleo_foundation/models/schemas/result.py +35 -20
- maleo_foundation/models/schemas/signature.py +5 -2
- maleo_foundation/models/schemas/token.py +5 -2
- maleo_foundation/models/table.py +33 -27
- maleo_foundation/models/transfers/__init__.py +2 -1
- maleo_foundation/models/transfers/general/__init__.py +2 -1
- maleo_foundation/models/transfers/general/configurations/__init__.py +10 -4
- maleo_foundation/models/transfers/general/configurations/cache/__init__.py +3 -2
- maleo_foundation/models/transfers/general/configurations/cache/redis.py +13 -5
- maleo_foundation/models/transfers/general/configurations/client/__init__.py +5 -1
- maleo_foundation/models/transfers/general/configurations/client/maleo.py +38 -12
- maleo_foundation/models/transfers/general/configurations/database.py +5 -2
- maleo_foundation/models/transfers/general/configurations/middleware.py +22 -15
- maleo_foundation/models/transfers/general/configurations/service.py +2 -1
- maleo_foundation/models/transfers/general/credentials.py +2 -1
- maleo_foundation/models/transfers/general/database.py +11 -4
- maleo_foundation/models/transfers/general/key.py +13 -4
- maleo_foundation/models/transfers/general/request.py +28 -9
- maleo_foundation/models/transfers/general/settings.py +12 -22
- maleo_foundation/models/transfers/general/signature.py +4 -2
- maleo_foundation/models/transfers/general/token.py +34 -27
- maleo_foundation/models/transfers/parameters/__init__.py +2 -1
- maleo_foundation/models/transfers/parameters/client.py +15 -19
- maleo_foundation/models/transfers/parameters/encryption/__init__.py +2 -1
- maleo_foundation/models/transfers/parameters/encryption/aes.py +7 -5
- maleo_foundation/models/transfers/parameters/encryption/rsa.py +7 -5
- maleo_foundation/models/transfers/parameters/general.py +15 -13
- maleo_foundation/models/transfers/parameters/hash/__init__.py +2 -1
- maleo_foundation/models/transfers/parameters/hash/bcrypt.py +5 -5
- maleo_foundation/models/transfers/parameters/hash/hmac.py +6 -6
- maleo_foundation/models/transfers/parameters/hash/sha256.py +5 -5
- maleo_foundation/models/transfers/parameters/key.py +9 -8
- maleo_foundation/models/transfers/parameters/service.py +42 -48
- maleo_foundation/models/transfers/parameters/signature.py +7 -4
- maleo_foundation/models/transfers/parameters/token.py +10 -10
- maleo_foundation/models/transfers/results/__init__.py +2 -1
- maleo_foundation/models/transfers/results/client/__init__.py +2 -1
- maleo_foundation/models/transfers/results/client/controllers/__init__.py +2 -1
- maleo_foundation/models/transfers/results/client/controllers/http.py +10 -7
- maleo_foundation/models/transfers/results/client/service.py +12 -6
- maleo_foundation/models/transfers/results/encryption/__init__.py +2 -1
- maleo_foundation/models/transfers/results/encryption/aes.py +13 -5
- maleo_foundation/models/transfers/results/encryption/rsa.py +12 -4
- maleo_foundation/models/transfers/results/hash.py +7 -3
- maleo_foundation/models/transfers/results/key.py +18 -6
- maleo_foundation/models/transfers/results/service/__init__.py +2 -3
- maleo_foundation/models/transfers/results/service/controllers/__init__.py +2 -1
- maleo_foundation/models/transfers/results/service/controllers/rest.py +14 -11
- maleo_foundation/models/transfers/results/service/general.py +16 -10
- maleo_foundation/models/transfers/results/signature.py +12 -4
- maleo_foundation/models/transfers/results/token.py +10 -4
- maleo_foundation/rest_controller_result.py +23 -21
- maleo_foundation/types.py +15 -14
- maleo_foundation/utils/__init__.py +2 -1
- maleo_foundation/utils/cache.py +10 -13
- maleo_foundation/utils/client.py +25 -12
- maleo_foundation/utils/controller.py +59 -37
- maleo_foundation/utils/dependencies/__init__.py +2 -1
- maleo_foundation/utils/dependencies/auth.py +5 -12
- maleo_foundation/utils/dependencies/context.py +3 -4
- maleo_foundation/utils/exceptions.py +50 -28
- maleo_foundation/utils/extractor.py +18 -6
- maleo_foundation/utils/formatter/__init__.py +2 -1
- maleo_foundation/utils/formatter/case.py +5 -4
- maleo_foundation/utils/loaders/__init__.py +2 -1
- maleo_foundation/utils/loaders/credential/__init__.py +2 -1
- maleo_foundation/utils/loaders/credential/google.py +29 -15
- maleo_foundation/utils/loaders/json.py +3 -2
- maleo_foundation/utils/loaders/key/__init__.py +2 -1
- maleo_foundation/utils/loaders/key/rsa.py +26 -13
- maleo_foundation/utils/loaders/yaml.py +2 -1
- maleo_foundation/utils/logging.py +70 -46
- maleo_foundation/utils/merger.py +7 -9
- maleo_foundation/utils/query.py +41 -34
- maleo_foundation/utils/repository.py +28 -13
- maleo_foundation/utils/searcher.py +4 -6
- {maleo_foundation-0.3.45.dist-info → maleo_foundation-0.3.47.dist-info}/METADATA +14 -1
- maleo_foundation-0.3.47.dist-info/RECORD +137 -0
- maleo_foundation/expanded_types/repository.py +0 -68
- maleo_foundation/models/transfers/results/service/repository.py +0 -39
- maleo_foundation-0.3.45.dist-info/RECORD +0 -139
- {maleo_foundation-0.3.45.dist-info → maleo_foundation-0.3.47.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.3.45.dist-info → maleo_foundation-0.3.47.dist-info}/top_level.txt +0 -0
@@ -6,6 +6,7 @@ from uuid import UUID
|
|
6
6
|
from maleo_foundation.types import BaseTypes
|
7
7
|
from maleo_foundation.models.schemas.token import MaleoFoundationTokenSchemas
|
8
8
|
|
9
|
+
|
9
10
|
class MaleoFoundationTokenGeneralTransfers:
|
10
11
|
class BasePayload(BaseModel):
|
11
12
|
iss: BaseTypes.OptionalString = Field(None, description="Token's issuer")
|
@@ -20,7 +21,9 @@ class MaleoFoundationTokenGeneralTransfers:
|
|
20
21
|
o_uu: BaseTypes.OptionalUUID = Field(None, description="Organization's uuid")
|
21
22
|
o_k: BaseTypes.OptionalString = Field(None, description="Organization's key")
|
22
23
|
o_ot: BaseTypes.OptionalString = Field(None, description="Organization's type")
|
23
|
-
uor: BaseTypes.OptionalListOfStrings = Field(
|
24
|
+
uor: BaseTypes.OptionalListOfStrings = Field(
|
25
|
+
None, description="User Organization Role"
|
26
|
+
)
|
24
27
|
|
25
28
|
class DecodePayload(BasePayload):
|
26
29
|
iat_dt: datetime = Field(..., description="Issued at (datetime)")
|
@@ -46,42 +49,47 @@ class MaleoFoundationTokenGeneralTransfers:
|
|
46
49
|
"iat_dt": self.iat_dt.isoformat(),
|
47
50
|
"iat": self.iat,
|
48
51
|
"exp_dt": self.iat_dt.isoformat(),
|
49
|
-
"exp": self.exp
|
52
|
+
"exp": self.exp,
|
50
53
|
}
|
51
54
|
|
52
55
|
return result
|
53
56
|
|
54
57
|
@classmethod
|
55
|
-
def from_google_pubsub_object(cls, obj:Dict[str, Any]):
|
58
|
+
def from_google_pubsub_object(cls, obj: Dict[str, Any]):
|
56
59
|
return cls(
|
57
|
-
iss
|
58
|
-
sub
|
59
|
-
sr
|
60
|
-
u_i
|
61
|
-
u_uu
|
62
|
-
u_u
|
63
|
-
u_e
|
64
|
-
u_ut
|
65
|
-
o_i
|
66
|
-
o_uu
|
67
|
-
o_k
|
68
|
-
o_ot
|
69
|
-
uor
|
70
|
-
iat_dt
|
71
|
-
iat
|
72
|
-
exp_dt
|
73
|
-
exp
|
60
|
+
iss=None if obj["iss"] is None else obj["iss"]["string"],
|
61
|
+
sub=obj["sub"],
|
62
|
+
sr=obj["sr"],
|
63
|
+
u_i=obj["u_i"],
|
64
|
+
u_uu=UUID(obj["u_uu"]),
|
65
|
+
u_u=obj["u_u"],
|
66
|
+
u_e=obj["u_e"],
|
67
|
+
u_ut=obj["u_ut"],
|
68
|
+
o_i=None if obj["o_i"] is None else obj["o_i"]["int"],
|
69
|
+
o_uu=None if obj["o_uu"] is None else UUID(obj["o_uu"]["string"]),
|
70
|
+
o_k=None if obj["o_k"] is None else obj["o_k"]["string"],
|
71
|
+
o_ot=None if obj["o_ot"] is None else obj["o_ot"]["string"],
|
72
|
+
uor=None if obj["uor"] is None else obj["uor"]["array"],
|
73
|
+
iat_dt=datetime.fromisoformat(obj["iat_dt"]),
|
74
|
+
iat=int(obj["iat"]),
|
75
|
+
exp_dt=datetime.fromisoformat(obj["exp_dt"]),
|
76
|
+
exp=int(obj["exp"]),
|
74
77
|
)
|
75
78
|
|
76
|
-
class BaseEncodePayload(MaleoFoundationTokenSchemas.ExpIn, BasePayload):
|
79
|
+
class BaseEncodePayload(MaleoFoundationTokenSchemas.ExpIn, BasePayload):
|
80
|
+
pass
|
77
81
|
|
78
82
|
class EncodePayload(DecodePayload):
|
79
|
-
iat_dt: datetime = Field(
|
80
|
-
|
83
|
+
iat_dt: datetime = Field(
|
84
|
+
datetime.now(timezone.utc), description="Issued at (datetime)"
|
85
|
+
)
|
86
|
+
exp_in: int = Field(
|
87
|
+
15, ge=1, description="Expires in (integer, minutes)", exclude=True
|
88
|
+
)
|
81
89
|
|
82
90
|
@model_validator(mode="before")
|
83
91
|
@classmethod
|
84
|
-
def set_iat_and_exp(cls, values:dict):
|
92
|
+
def set_iat_and_exp(cls, values: dict):
|
85
93
|
iat_dt = values.get("iat_dt", None)
|
86
94
|
if not iat_dt:
|
87
95
|
iat_dt = datetime.now(timezone.utc)
|
@@ -89,7 +97,7 @@ class MaleoFoundationTokenGeneralTransfers:
|
|
89
97
|
if not isinstance(iat_dt, datetime):
|
90
98
|
iat_dt = datetime.fromisoformat(iat_dt)
|
91
99
|
values["iat_dt"] = iat_dt
|
92
|
-
|
100
|
+
# * Convert `iat` to timestamp (int)
|
93
101
|
values["iat"] = int(iat_dt.timestamp())
|
94
102
|
exp_in = values.get("exp_in")
|
95
103
|
exp_dt = values.get("exp_dt", None)
|
@@ -99,7 +107,6 @@ class MaleoFoundationTokenGeneralTransfers:
|
|
99
107
|
if not isinstance(exp_dt, datetime):
|
100
108
|
exp_dt = datetime.fromisoformat(exp_dt)
|
101
109
|
values["exp_dt"] = exp_dt
|
102
|
-
|
110
|
+
# * Convert `exp_dt` to timestamp (int)
|
103
111
|
values["exp"] = int(exp_dt.timestamp())
|
104
112
|
return values
|
105
|
-
|
@@ -3,7 +3,8 @@ from .general import BaseGeneralParametersTransfers
|
|
3
3
|
from .service import BaseServiceParametersTransfers
|
4
4
|
from .client import BaseClientParametersTransfers
|
5
5
|
|
6
|
+
|
6
7
|
class BaseParametersTransfers:
|
7
8
|
General = BaseGeneralParametersTransfers
|
8
9
|
Service = BaseServiceParametersTransfers
|
9
|
-
Client = BaseClientParametersTransfers
|
10
|
+
Client = BaseClientParametersTransfers
|
@@ -5,28 +5,27 @@ from typing import Self
|
|
5
5
|
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
6
6
|
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
7
7
|
|
8
|
+
|
8
9
|
class BaseClientParametersTransfers:
|
9
10
|
class GetUnpaginatedMultiple(
|
10
11
|
BaseParameterSchemas.SortColumns,
|
11
12
|
BaseParameterSchemas.Search,
|
12
13
|
BaseParameterSchemas.OptionalListOfStatuses,
|
13
|
-
BaseParameterSchemas.DateFilters
|
14
|
+
BaseParameterSchemas.DateFilters,
|
14
15
|
):
|
15
16
|
pass
|
16
17
|
|
17
18
|
class GetUnpaginatedMultipleQuery(
|
18
|
-
BaseParameterSchemas.Sorts,
|
19
|
-
BaseParameterSchemas.Filters,
|
20
|
-
GetUnpaginatedMultiple
|
19
|
+
BaseParameterSchemas.Sorts, BaseParameterSchemas.Filters, GetUnpaginatedMultiple
|
21
20
|
):
|
22
21
|
@model_validator(mode="after")
|
23
22
|
def set_sort(self) -> Self:
|
24
|
-
|
23
|
+
# * Process sort_columns parameters
|
25
24
|
sort = []
|
26
25
|
for item in self.sort_columns:
|
27
26
|
sort.append(f"{item.name}.{item.order.value}")
|
28
27
|
|
29
|
-
|
28
|
+
# * Only update if we have valid sort, otherwise keep the default
|
30
29
|
if sort:
|
31
30
|
self.sorts = sort
|
32
31
|
|
@@ -34,7 +33,7 @@ class BaseClientParametersTransfers:
|
|
34
33
|
|
35
34
|
@model_validator(mode="after")
|
36
35
|
def set_filter(self) -> Self:
|
37
|
-
|
36
|
+
# * Process filter parameters
|
38
37
|
filter = []
|
39
38
|
for item in self.date_filters:
|
40
39
|
if item.from_date or item.to_date:
|
@@ -45,7 +44,7 @@ class BaseClientParametersTransfers:
|
|
45
44
|
filter_string += f"|to::{item.to_date.isoformat()}"
|
46
45
|
filter.append(filter_string)
|
47
46
|
|
48
|
-
|
47
|
+
# * Only update if we have valid filter, otherwise keep the default
|
49
48
|
if filter:
|
50
49
|
self.filters = filter
|
51
50
|
|
@@ -63,24 +62,21 @@ class BaseClientParametersTransfers:
|
|
63
62
|
return params
|
64
63
|
|
65
64
|
class GetPaginatedMultiple(
|
66
|
-
BaseGeneralSchemas.SimplePagination,
|
67
|
-
GetUnpaginatedMultiple
|
65
|
+
BaseGeneralSchemas.SimplePagination, GetUnpaginatedMultiple
|
68
66
|
):
|
69
67
|
pass
|
70
68
|
|
71
69
|
class GetPaginatedMultipleQuery(
|
72
|
-
BaseParameterSchemas.Sorts,
|
73
|
-
BaseParameterSchemas.Filters,
|
74
|
-
GetPaginatedMultiple
|
70
|
+
BaseParameterSchemas.Sorts, BaseParameterSchemas.Filters, GetPaginatedMultiple
|
75
71
|
):
|
76
72
|
@model_validator(mode="after")
|
77
73
|
def set_sort(self) -> Self:
|
78
|
-
|
74
|
+
# * Process sort_columns parameters
|
79
75
|
sort = []
|
80
76
|
for item in self.sort_columns:
|
81
77
|
sort.append(f"{item.name}.{item.order.value}")
|
82
78
|
|
83
|
-
|
79
|
+
# * Only update if we have valid sort, otherwise keep the default
|
84
80
|
if sort:
|
85
81
|
self.sorts = sort
|
86
82
|
|
@@ -88,7 +84,7 @@ class BaseClientParametersTransfers:
|
|
88
84
|
|
89
85
|
@model_validator(mode="after")
|
90
86
|
def set_filter(self) -> Self:
|
91
|
-
|
87
|
+
# * Process filter parameters
|
92
88
|
filter = []
|
93
89
|
for item in self.date_filters:
|
94
90
|
if item.from_date or item.to_date:
|
@@ -99,7 +95,7 @@ class BaseClientParametersTransfers:
|
|
99
95
|
filter_string += f"|to::{item.to_date.isoformat()}"
|
100
96
|
filter.append(filter_string)
|
101
97
|
|
102
|
-
|
98
|
+
# * Only update if we have valid filter, otherwise keep the default
|
103
99
|
if filter:
|
104
100
|
self.filters = filter
|
105
101
|
|
@@ -113,7 +109,7 @@ class BaseClientParametersTransfers:
|
|
113
109
|
"search": self.search,
|
114
110
|
"sorts": self.sorts,
|
115
111
|
"page": self.page,
|
116
|
-
"limit": self.limit
|
112
|
+
"limit": self.limit,
|
117
113
|
}
|
118
114
|
params = {k: v for k, v in raw_params.items() if v not in (None, [], "")}
|
119
|
-
return params
|
115
|
+
return params
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
2
2
|
from .aes import MaleoFoundationAESEncryptionParametersTransfers
|
3
3
|
from .rsa import MaleoFoundationRSAEncryptionParametersTransfers
|
4
4
|
|
5
|
+
|
5
6
|
class BaseEncryptionParametersTransfers:
|
6
7
|
AES = MaleoFoundationAESEncryptionParametersTransfers
|
7
|
-
RSA = MaleoFoundationRSAEncryptionParametersTransfers
|
8
|
+
RSA = MaleoFoundationRSAEncryptionParametersTransfers
|
@@ -1,13 +1,15 @@
|
|
1
1
|
from maleo_foundation.models.schemas.encryption import MaleoFoundationEncryptionSchemas
|
2
2
|
|
3
|
+
|
3
4
|
class MaleoFoundationAESEncryptionParametersTransfers:
|
4
5
|
class Encrypt(
|
5
|
-
MaleoFoundationEncryptionSchemas.Plaintext,
|
6
|
-
|
7
|
-
|
6
|
+
MaleoFoundationEncryptionSchemas.Plaintext, MaleoFoundationEncryptionSchemas.Key
|
7
|
+
):
|
8
|
+
pass
|
8
9
|
|
9
10
|
class Decrypt(
|
10
11
|
MaleoFoundationEncryptionSchemas.Ciphertext,
|
11
12
|
MaleoFoundationEncryptionSchemas.InitializationVector,
|
12
|
-
MaleoFoundationEncryptionSchemas.Key
|
13
|
-
):
|
13
|
+
MaleoFoundationEncryptionSchemas.Key,
|
14
|
+
):
|
15
|
+
pass
|
@@ -1,13 +1,15 @@
|
|
1
1
|
from maleo_foundation.models.schemas.encryption import MaleoFoundationEncryptionSchemas
|
2
2
|
|
3
|
+
|
3
4
|
class MaleoFoundationRSAEncryptionParametersTransfers:
|
4
5
|
class Encrypt(
|
5
|
-
MaleoFoundationEncryptionSchemas.Plaintext,
|
6
|
-
|
7
|
-
|
6
|
+
MaleoFoundationEncryptionSchemas.Plaintext, MaleoFoundationEncryptionSchemas.Key
|
7
|
+
):
|
8
|
+
pass
|
8
9
|
|
9
10
|
class Decrypt(
|
10
11
|
MaleoFoundationEncryptionSchemas.Ciphertext,
|
11
12
|
MaleoFoundationEncryptionSchemas.Password,
|
12
|
-
MaleoFoundationEncryptionSchemas.Key
|
13
|
-
):
|
13
|
+
MaleoFoundationEncryptionSchemas.Key,
|
14
|
+
):
|
15
|
+
pass
|
@@ -2,24 +2,26 @@ from __future__ import annotations
|
|
2
2
|
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
3
3
|
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
4
4
|
|
5
|
+
|
5
6
|
class BaseGeneralParametersTransfers:
|
6
7
|
class FieldExpansionProcessor(
|
7
|
-
BaseParameterSchemas.Expand,
|
8
|
-
|
9
|
-
|
8
|
+
BaseParameterSchemas.Expand, BaseParameterSchemas.Data
|
9
|
+
):
|
10
|
+
pass
|
10
11
|
|
11
|
-
class FieldModificationProcessor(BaseParameterSchemas.Data):
|
12
|
+
class FieldModificationProcessor(BaseParameterSchemas.Data):
|
13
|
+
pass
|
12
14
|
|
13
|
-
class GetSingleQuery(BaseParameterSchemas.OptionalListOfStatuses):
|
15
|
+
class GetSingleQuery(BaseParameterSchemas.OptionalListOfStatuses):
|
16
|
+
pass
|
14
17
|
|
15
18
|
class BaseGetSingle(
|
16
|
-
BaseParameterSchemas.IdentifierValue,
|
17
|
-
|
18
|
-
|
19
|
+
BaseParameterSchemas.IdentifierValue, BaseParameterSchemas.IdentifierType
|
20
|
+
):
|
21
|
+
pass
|
19
22
|
|
20
|
-
class GetSingle(
|
21
|
-
|
22
|
-
BaseGetSingle
|
23
|
-
): pass
|
23
|
+
class GetSingle(BaseParameterSchemas.OptionalListOfStatuses, BaseGetSingle):
|
24
|
+
pass
|
24
25
|
|
25
|
-
class StatusUpdate(BaseGeneralSchemas.Status):
|
26
|
+
class StatusUpdate(BaseGeneralSchemas.Status):
|
27
|
+
pass
|
@@ -3,7 +3,8 @@ from .bcrypt import MaleoFoundationBcryptHashParametersTransfers
|
|
3
3
|
from .hmac import MaleoFoundationHMACHashParametersTransfers
|
4
4
|
from .sha256 import MaleoFoundationSHA256HashParametersTransfers
|
5
5
|
|
6
|
+
|
6
7
|
class BaseHashParametersTransfers:
|
7
8
|
Bcrypt = MaleoFoundationBcryptHashParametersTransfers
|
8
9
|
HMAC = MaleoFoundationHMACHashParametersTransfers
|
9
|
-
SHA256 = MaleoFoundationSHA256HashParametersTransfers
|
10
|
+
SHA256 = MaleoFoundationSHA256HashParametersTransfers
|
@@ -1,9 +1,9 @@
|
|
1
1
|
from maleo_foundation.models.schemas.hash import MaleoFoundationHashSchemas
|
2
2
|
|
3
|
+
|
3
4
|
class MaleoFoundationBcryptHashParametersTransfers:
|
4
|
-
class Hash(MaleoFoundationHashSchemas.Message):
|
5
|
+
class Hash(MaleoFoundationHashSchemas.Message):
|
6
|
+
pass
|
5
7
|
|
6
|
-
class Verify(
|
7
|
-
|
8
|
-
MaleoFoundationHashSchemas.Message
|
9
|
-
): pass
|
8
|
+
class Verify(MaleoFoundationHashSchemas.Hash, MaleoFoundationHashSchemas.Message):
|
9
|
+
pass
|
@@ -1,13 +1,13 @@
|
|
1
1
|
from maleo_foundation.models.schemas.hash import MaleoFoundationHashSchemas
|
2
2
|
|
3
|
+
|
3
4
|
class MaleoFoundationHMACHashParametersTransfers:
|
4
|
-
class Hash(
|
5
|
-
|
6
|
-
MaleoFoundationHashSchemas.Key
|
7
|
-
): pass
|
5
|
+
class Hash(MaleoFoundationHashSchemas.Message, MaleoFoundationHashSchemas.Key):
|
6
|
+
pass
|
8
7
|
|
9
8
|
class Verify(
|
10
9
|
MaleoFoundationHashSchemas.Hash,
|
11
10
|
MaleoFoundationHashSchemas.Message,
|
12
|
-
MaleoFoundationHashSchemas.Key
|
13
|
-
):
|
11
|
+
MaleoFoundationHashSchemas.Key,
|
12
|
+
):
|
13
|
+
pass
|
@@ -1,9 +1,9 @@
|
|
1
1
|
from maleo_foundation.models.schemas.hash import MaleoFoundationHashSchemas
|
2
2
|
|
3
|
+
|
3
4
|
class MaleoFoundationSHA256HashParametersTransfers:
|
4
|
-
class Hash(MaleoFoundationHashSchemas.Message):
|
5
|
+
class Hash(MaleoFoundationHashSchemas.Message):
|
6
|
+
pass
|
5
7
|
|
6
|
-
class Verify(
|
7
|
-
|
8
|
-
MaleoFoundationHashSchemas.Message
|
9
|
-
): pass
|
8
|
+
class Verify(MaleoFoundationHashSchemas.Hash, MaleoFoundationHashSchemas.Message):
|
9
|
+
pass
|
@@ -1,13 +1,14 @@
|
|
1
1
|
from maleo_foundation.models.schemas.key import BaseKeySchemas
|
2
|
-
from maleo_foundation.models.transfers.general.key import
|
2
|
+
from maleo_foundation.models.transfers.general.key import (
|
3
|
+
MaleoFoundationKeyGeneralTransfers,
|
4
|
+
)
|
5
|
+
|
3
6
|
|
4
7
|
class MaleoFoundationKeyParametersTransfers:
|
5
|
-
class CreatePrivateOrPair(
|
6
|
-
|
7
|
-
BaseKeySchemas.KeySize
|
8
|
-
): pass
|
8
|
+
class CreatePrivateOrPair(BaseKeySchemas.Password, BaseKeySchemas.KeySize):
|
9
|
+
pass
|
9
10
|
|
10
11
|
class CreatePublic(
|
11
|
-
BaseKeySchemas.Password,
|
12
|
-
|
13
|
-
|
12
|
+
BaseKeySchemas.Password, MaleoFoundationKeyGeneralTransfers.PrivateKey
|
13
|
+
):
|
14
|
+
pass
|
@@ -6,153 +6,147 @@ from maleo_foundation.enums import BaseEnums
|
|
6
6
|
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
7
7
|
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
8
8
|
|
9
|
+
|
9
10
|
class BaseServiceParametersTransfers:
|
10
11
|
class GetUnpaginatedMultipleQuery(
|
11
12
|
BaseParameterSchemas.Sorts,
|
12
13
|
BaseParameterSchemas.Search,
|
13
14
|
BaseParameterSchemas.OptionalListOfStatuses,
|
14
|
-
BaseParameterSchemas.Filters
|
15
|
-
):
|
15
|
+
BaseParameterSchemas.Filters,
|
16
|
+
):
|
17
|
+
pass
|
16
18
|
|
17
19
|
class GetUnpaginatedMultiple(
|
18
20
|
BaseParameterSchemas.SortColumns,
|
19
21
|
BaseParameterSchemas.DateFilters,
|
20
|
-
GetUnpaginatedMultipleQuery
|
22
|
+
GetUnpaginatedMultipleQuery,
|
21
23
|
):
|
22
24
|
@model_validator(mode="after")
|
23
25
|
def set_sort_columns(self) -> Self:
|
24
|
-
|
26
|
+
# * Process sort parameters
|
25
27
|
sort_columns = []
|
26
28
|
for item in self.sorts:
|
27
|
-
parts = item.split(
|
29
|
+
parts = item.split(".")
|
28
30
|
if len(parts) == 2 and parts[1].lower() in ["asc", "desc"]:
|
29
31
|
try:
|
30
32
|
sort_columns.append(
|
31
|
-
BaseGeneralSchemas
|
32
|
-
.SortColumn(
|
33
|
+
BaseGeneralSchemas.SortColumn(
|
33
34
|
name=parts[0],
|
34
|
-
order=BaseEnums.SortOrder(parts[1].lower())
|
35
|
+
order=BaseEnums.SortOrder(parts[1].lower()),
|
35
36
|
)
|
36
37
|
)
|
37
38
|
except ValueError:
|
38
39
|
continue
|
39
40
|
|
40
|
-
|
41
|
+
# * Only update if we have valid sort columns, otherwise keep the default
|
41
42
|
if sort_columns:
|
42
43
|
self.sort_columns = sort_columns
|
43
44
|
return self
|
44
45
|
|
45
46
|
@model_validator(mode="after")
|
46
47
|
def set_date_filters(self) -> Self:
|
47
|
-
|
48
|
+
# * Process filter parameters
|
48
49
|
date_filters = []
|
49
50
|
for filter_item in self.filters:
|
50
|
-
parts = filter_item.split(
|
51
|
+
parts = filter_item.split("|")
|
51
52
|
if len(parts) >= 2 and parts[0]:
|
52
53
|
name = parts[0]
|
53
54
|
from_date = None
|
54
55
|
to_date = None
|
55
56
|
|
56
|
-
|
57
|
+
# * Process each part to extract from and to dates
|
57
58
|
for part in parts[1:]:
|
58
|
-
if part.startswith(
|
59
|
+
if part.startswith("from::"):
|
59
60
|
try:
|
60
|
-
from_date_str = part.replace(
|
61
|
+
from_date_str = part.replace("from::", "")
|
61
62
|
from_date = datetime.fromisoformat(from_date_str)
|
62
63
|
except ValueError:
|
63
64
|
continue
|
64
|
-
elif part.startswith(
|
65
|
+
elif part.startswith("to::"):
|
65
66
|
try:
|
66
|
-
to_date_str = part.replace(
|
67
|
+
to_date_str = part.replace("to::", "")
|
67
68
|
to_date = datetime.fromisoformat(to_date_str)
|
68
69
|
except ValueError:
|
69
70
|
continue
|
70
71
|
|
71
|
-
|
72
|
+
# * Only add filter if at least one date is specified
|
72
73
|
if from_date or to_date:
|
73
74
|
date_filters.append(
|
74
|
-
BaseGeneralSchemas
|
75
|
-
|
76
|
-
name=name,
|
77
|
-
from_date=from_date,
|
78
|
-
to_date=to_date
|
75
|
+
BaseGeneralSchemas.DateFilter(
|
76
|
+
name=name, from_date=from_date, to_date=to_date
|
79
77
|
)
|
80
78
|
)
|
81
79
|
|
82
|
-
|
80
|
+
# * Update date_filters
|
83
81
|
self.date_filters = date_filters
|
84
82
|
return self
|
85
83
|
|
86
84
|
class GetPaginatedMultipleQuery(
|
87
|
-
BaseGeneralSchemas.SimplePagination,
|
88
|
-
|
89
|
-
|
85
|
+
BaseGeneralSchemas.SimplePagination, GetUnpaginatedMultipleQuery
|
86
|
+
):
|
87
|
+
pass
|
90
88
|
|
91
89
|
class GetPaginatedMultiple(
|
92
90
|
BaseParameterSchemas.SortColumns,
|
93
91
|
BaseParameterSchemas.DateFilters,
|
94
|
-
GetPaginatedMultipleQuery
|
92
|
+
GetPaginatedMultipleQuery,
|
95
93
|
):
|
96
94
|
@model_validator(mode="after")
|
97
95
|
def set_sort_columns(self) -> Self:
|
98
|
-
|
96
|
+
# * Process sort parameters
|
99
97
|
sort_columns = []
|
100
98
|
for item in self.sorts:
|
101
|
-
parts = item.split(
|
99
|
+
parts = item.split(".")
|
102
100
|
if len(parts) == 2 and parts[1].lower() in ["asc", "desc"]:
|
103
101
|
try:
|
104
102
|
sort_columns.append(
|
105
|
-
BaseGeneralSchemas
|
106
|
-
.SortColumn(
|
103
|
+
BaseGeneralSchemas.SortColumn(
|
107
104
|
name=parts[0],
|
108
|
-
order=BaseEnums.SortOrder(parts[1].lower())
|
105
|
+
order=BaseEnums.SortOrder(parts[1].lower()),
|
109
106
|
)
|
110
107
|
)
|
111
108
|
except ValueError:
|
112
109
|
continue
|
113
110
|
|
114
|
-
|
111
|
+
# * Only update if we have valid sort columns, otherwise keep the default
|
115
112
|
if sort_columns:
|
116
113
|
self.sort_columns = sort_columns
|
117
114
|
return self
|
118
115
|
|
119
116
|
@model_validator(mode="after")
|
120
117
|
def set_date_filters(self) -> Self:
|
121
|
-
|
118
|
+
# * Process filter parameters
|
122
119
|
date_filters = []
|
123
120
|
for filter_item in self.filters:
|
124
|
-
parts = filter_item.split(
|
121
|
+
parts = filter_item.split("|")
|
125
122
|
if len(parts) >= 2 and parts[0]:
|
126
123
|
name = parts[0]
|
127
124
|
from_date = None
|
128
125
|
to_date = None
|
129
126
|
|
130
|
-
|
127
|
+
# * Process each part to extract from and to dates
|
131
128
|
for part in parts[1:]:
|
132
|
-
if part.startswith(
|
129
|
+
if part.startswith("from::"):
|
133
130
|
try:
|
134
|
-
from_date_str = part.replace(
|
131
|
+
from_date_str = part.replace("from::", "")
|
135
132
|
from_date = datetime.fromisoformat(from_date_str)
|
136
133
|
except ValueError:
|
137
134
|
continue
|
138
|
-
elif part.startswith(
|
135
|
+
elif part.startswith("to::"):
|
139
136
|
try:
|
140
|
-
to_date_str = part.replace(
|
137
|
+
to_date_str = part.replace("to::", "")
|
141
138
|
to_date = datetime.fromisoformat(to_date_str)
|
142
139
|
except ValueError:
|
143
140
|
continue
|
144
141
|
|
145
|
-
|
142
|
+
# * Only add filter if at least one date is specified
|
146
143
|
if from_date or to_date:
|
147
144
|
date_filters.append(
|
148
|
-
BaseGeneralSchemas
|
149
|
-
|
150
|
-
name=name,
|
151
|
-
from_date=from_date,
|
152
|
-
to_date=to_date
|
145
|
+
BaseGeneralSchemas.DateFilter(
|
146
|
+
name=name, from_date=from_date, to_date=to_date
|
153
147
|
)
|
154
148
|
)
|
155
149
|
|
156
|
-
|
150
|
+
# * Update date_filters
|
157
151
|
self.date_filters = date_filters
|
158
|
-
return self
|
152
|
+
return self
|
@@ -1,14 +1,17 @@
|
|
1
1
|
from maleo_foundation.models.schemas.signature import MaleoFoundationSignatureSchemas
|
2
2
|
|
3
|
+
|
3
4
|
class MaleoFoundationSignatureParametersTransfers:
|
4
5
|
class Sign(
|
5
6
|
MaleoFoundationSignatureSchemas.Message,
|
6
7
|
MaleoFoundationSignatureSchemas.Password,
|
7
|
-
MaleoFoundationSignatureSchemas.Key
|
8
|
-
):
|
8
|
+
MaleoFoundationSignatureSchemas.Key,
|
9
|
+
):
|
10
|
+
pass
|
9
11
|
|
10
12
|
class Verify(
|
11
13
|
MaleoFoundationSignatureSchemas.Signature,
|
12
14
|
MaleoFoundationSignatureSchemas.Message,
|
13
|
-
MaleoFoundationSignatureSchemas.Key
|
14
|
-
):
|
15
|
+
MaleoFoundationSignatureSchemas.Key,
|
16
|
+
):
|
17
|
+
pass
|
@@ -1,16 +1,16 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
from pydantic import Field
|
3
3
|
from maleo_foundation.models.schemas.token import MaleoFoundationTokenSchemas
|
4
|
-
from maleo_foundation.models.transfers.general.token import
|
4
|
+
from maleo_foundation.models.transfers.general.token import (
|
5
|
+
MaleoFoundationTokenGeneralTransfers,
|
6
|
+
)
|
7
|
+
|
5
8
|
|
6
9
|
class MaleoFoundationTokenParametersTransfers:
|
7
|
-
class Encode(
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
payload: MaleoFoundationTokenGeneralTransfers.BaseEncodePayload = Field(..., description="Encode payload")
|
10
|
+
class Encode(MaleoFoundationTokenSchemas.Password, MaleoFoundationTokenSchemas.Key):
|
11
|
+
payload: MaleoFoundationTokenGeneralTransfers.BaseEncodePayload = Field(
|
12
|
+
..., description="Encode payload"
|
13
|
+
)
|
12
14
|
|
13
|
-
class Decode(
|
14
|
-
|
15
|
-
MaleoFoundationTokenSchemas.Key
|
16
|
-
): pass
|
15
|
+
class Decode(MaleoFoundationTokenSchemas.Token, MaleoFoundationTokenSchemas.Key):
|
16
|
+
pass
|