maleo-foundation 0.0.22__py3-none-any.whl → 0.0.24__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/models/schemas/general.py +16 -15
- maleo_foundation/models/schemas/parameter.py +6 -4
- maleo_foundation/models/schemas/result.py +8 -10
- maleo_foundation/models/types/__init__.py +4 -0
- maleo_foundation/models/types/general.py +44 -0
- maleo_foundation/models/types/parameter.py +9 -0
- {maleo_foundation-0.0.22.dist-info → maleo_foundation-0.0.24.dist-info}/METADATA +1 -1
- {maleo_foundation-0.0.22.dist-info → maleo_foundation-0.0.24.dist-info}/RECORD +10 -8
- {maleo_foundation-0.0.22.dist-info → maleo_foundation-0.0.24.dist-info}/WHEEL +1 -1
- {maleo_foundation-0.0.22.dist-info → maleo_foundation-0.0.24.dist-info}/top_level.txt +0 -0
@@ -1,25 +1,26 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
from datetime import date, datetime, timedelta, timezone
|
3
3
|
from pydantic import BaseModel, Field, model_validator, field_serializer, FieldSerializationInfo
|
4
|
-
from typing import Optional,
|
4
|
+
from typing import Optional, Any
|
5
5
|
from uuid import UUID
|
6
|
-
from maleo_foundation.models.enums import BaseEnums
|
7
6
|
from maleo_foundation.constants import REFRESH_TOKEN_DURATION_DAYS, ACCESS_TOKEN_DURATION_MINUTES
|
7
|
+
from maleo_foundation.models.enums import BaseEnums
|
8
|
+
from maleo_foundation.models.types.general import BaseGeneralTypes
|
8
9
|
|
9
10
|
class BaseGeneralSchemas:
|
10
11
|
class IDs(BaseModel):
|
11
|
-
ids:
|
12
|
+
ids:BaseGeneralTypes.OptionalListOfIntegers = Field(None, description="Specific IDs")
|
12
13
|
|
13
14
|
class Search(BaseModel):
|
14
|
-
search:
|
15
|
+
search:BaseGeneralTypes.OptionalString = Field(None, description="Search parameter string.")
|
15
16
|
|
16
17
|
class DateFilter(BaseModel):
|
17
18
|
name:str = Field(..., description="Column name.")
|
18
|
-
from_date:
|
19
|
-
to_date:
|
19
|
+
from_date:BaseGeneralTypes.OptionalDatetime = Field(None, description="From date.")
|
20
|
+
to_date:BaseGeneralTypes.OptionalDatetime = Field(None, description="To date.")
|
20
21
|
|
21
22
|
class Statuses(BaseModel):
|
22
|
-
statuses:
|
23
|
+
statuses:BaseGeneralTypes.OptionalListOfStatuses = Field(None, description="Data's status")
|
23
24
|
|
24
25
|
class SortColumn(BaseModel):
|
25
26
|
name:str = Field(..., description="Column name.")
|
@@ -38,7 +39,7 @@ class BaseGeneralSchemas:
|
|
38
39
|
action:BaseEnums.StatusUpdateAction = Field(..., description="Status update's action to be executed")
|
39
40
|
|
40
41
|
class Expand(BaseModel):
|
41
|
-
expand:
|
42
|
+
expand:BaseGeneralTypes.OptionalListOfStrings = Field(None, description="Expanded field(s)")
|
42
43
|
|
43
44
|
class PrivateKey(BaseModel):
|
44
45
|
private_key:str = Field(..., description="Private key in str format.")
|
@@ -60,13 +61,13 @@ class BaseGeneralSchemas:
|
|
60
61
|
class Timestamps(BaseModel):
|
61
62
|
created_at:datetime = Field(..., description="Data's created_at timestamp")
|
62
63
|
updated_at:datetime = Field(..., description="Data's updated_at timestamp")
|
63
|
-
deleted_at:
|
64
|
-
restored_at:
|
65
|
-
deactivated_at:
|
64
|
+
deleted_at:BaseGeneralTypes.OptionalDatetime = Field(..., description="Data's deleted_at timestamp")
|
65
|
+
restored_at:BaseGeneralTypes.OptionalDatetime = Field(..., description="Data's restored_at timestamp")
|
66
|
+
deactivated_at:BaseGeneralTypes.OptionalDatetime = Field(..., description="Data's deactivated_at timestamp")
|
66
67
|
activated_at:datetime = Field(..., description="Data's activated_at timestamp")
|
67
68
|
|
68
69
|
@field_serializer('created_at', 'updated_at', 'deleted_at', 'restored_at', 'deactivated_at', 'activated_at')
|
69
|
-
def serialize_timestamps(self, value:
|
70
|
+
def serialize_timestamps(self, value:BaseGeneralTypes.OptionalDatetime, info:FieldSerializationInfo) -> str:
|
70
71
|
"""Serializes datetime/date fields to ISO format."""
|
71
72
|
if value is not None:
|
72
73
|
return value.isoformat()
|
@@ -76,7 +77,7 @@ class BaseGeneralSchemas:
|
|
76
77
|
status:BaseEnums.StatusType = Field(..., description="Data's status")
|
77
78
|
|
78
79
|
class Order(BaseModel):
|
79
|
-
order:
|
80
|
+
order:BaseGeneralTypes.OptionalInteger = Field(..., description="Data's order")
|
80
81
|
|
81
82
|
class Key(BaseModel):
|
82
83
|
key:str = Field(..., description="Data's key")
|
@@ -88,8 +89,8 @@ class BaseGeneralSchemas:
|
|
88
89
|
t:BaseEnums.TokenType = Field(..., description="Token Type")
|
89
90
|
sr:UUID = Field(..., description="System role")
|
90
91
|
u:UUID = Field(..., description="user")
|
91
|
-
o:
|
92
|
-
uor:
|
92
|
+
o:BaseGeneralTypes.OptionalUUID = Field(..., description="Organization")
|
93
|
+
uor:BaseGeneralTypes.OptionalListOfUUIDs = Field(..., description="User Organization Role")
|
93
94
|
iat_dt:datetime = Field(datetime.now(timezone.utc), description="Issued at (datetime)")
|
94
95
|
iat:int = Field(None, description="Issued at (integer)")
|
95
96
|
exp_dt:datetime = Field(None, description="Expired at (datetime)")
|
@@ -1,16 +1,18 @@
|
|
1
1
|
from pydantic import BaseModel, Field
|
2
2
|
from maleo_foundation.models.enums import BaseEnums
|
3
3
|
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
4
|
+
from maleo_foundation.models.types.general import BaseGeneralTypes
|
5
|
+
from maleo_foundation.models.types.parameter import BaseParameterTypes
|
4
6
|
|
5
7
|
class BaseParameterSchemas:
|
6
8
|
class Filters(BaseModel):
|
7
|
-
filters:
|
9
|
+
filters:BaseGeneralTypes.ListOfStrings = Field([], description="Filters for date range, e.g. 'created_at|from::<ISO_DATETIME>|to::<ISO_DATETIME>'.")
|
8
10
|
|
9
11
|
class DateFilters(BaseModel):
|
10
|
-
date_filters:
|
12
|
+
date_filters:BaseParameterTypes.ListOfDateFilters = Field([], description="Date filters to be applied")
|
11
13
|
|
12
14
|
class Sorts(BaseModel):
|
13
|
-
sorts:
|
15
|
+
sorts:BaseGeneralTypes.ListOfStrings = Field(["id.asc"], description="Sorting columns in 'column_name.asc' or 'column_name.desc' format.")
|
14
16
|
|
15
17
|
class SortColumns(BaseModel):
|
16
|
-
sort_columns:
|
18
|
+
sort_columns:BaseParameterTypes.ListOfSortColumns = Field([BaseGeneralSchemas.SortColumn(name="id", order=BaseEnums.SortOrder.ASC)], description="List of columns to be sorted")
|
@@ -1,37 +1,35 @@
|
|
1
1
|
from pydantic import BaseModel, Field
|
2
2
|
from typing import Literal, Optional, Any
|
3
3
|
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
4
|
+
from maleo_foundation.models.types.general import BaseGeneralTypes
|
4
5
|
|
5
6
|
class BaseResultSchemas:
|
6
7
|
class Base(BaseModel):
|
7
8
|
success:bool = Field(..., description="Success status")
|
8
|
-
code:
|
9
|
-
message:
|
10
|
-
description:
|
9
|
+
code:BaseGeneralTypes.OptionalString = Field(None, description="Optional result code")
|
10
|
+
message:BaseGeneralTypes.OptionalString = Field(None, description="Optional message")
|
11
|
+
description:BaseGeneralTypes.OptionalString = Field(None, description="Optional description")
|
11
12
|
data:Any = Field(..., description="Data")
|
12
|
-
other:
|
13
|
+
other:BaseGeneralTypes.OptionalAny = Field(None, description="Optional other information")
|
13
14
|
|
14
15
|
#* ----- ----- ----- Intermediary ----- ----- ----- *#
|
15
16
|
class Fail(Base):
|
16
|
-
success:
|
17
|
+
success:BaseGeneralTypes.LiteralFalse = Field(False, description="Success status")
|
17
18
|
data:None = Field(None, description="No data")
|
18
19
|
|
19
20
|
class Success(Base):
|
20
|
-
success:
|
21
|
+
success:BaseGeneralTypes.LiteralTrue = Field(True, description="Success status")
|
21
22
|
data:Any = Field(..., description="Data")
|
22
23
|
|
23
24
|
#* ----- ----- ----- Derived ----- ----- ----- *#
|
24
25
|
class NoData(Success):
|
25
|
-
success:Literal[True] = Field(True, description="Success status")
|
26
26
|
data:None = Field(None, description="No data")
|
27
27
|
|
28
28
|
class SingleData(Success):
|
29
|
-
success:Literal[True] = Field(True, description="Success status")
|
30
29
|
data:Any = Field(..., description="Fetched single data")
|
31
30
|
|
32
31
|
class UnpaginatedMultipleData(Success):
|
33
|
-
|
34
|
-
data:list[Any] = Field(..., description="Unpaginated multiple data")
|
32
|
+
data:BaseGeneralTypes.ListOfAny = Field(..., description="Unpaginated multiple data")
|
35
33
|
|
36
34
|
class PaginatedMultipleData(
|
37
35
|
UnpaginatedMultipleData,
|
@@ -1,9 +1,13 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
+
from .general import BaseGeneralTypes
|
3
|
+
from .parameter import BaseParameterTypes
|
2
4
|
from .query import BaseQueryTypes
|
3
5
|
from .service import BaseServiceTypes
|
4
6
|
from .client import BaseClientTypes
|
5
7
|
|
6
8
|
class BaseTypes:
|
9
|
+
General = BaseGeneralTypes
|
10
|
+
Parameter = BaseParameterTypes
|
7
11
|
Query = BaseQueryTypes
|
8
12
|
Service = BaseServiceTypes
|
9
13
|
Client = BaseClientTypes
|
@@ -0,0 +1,44 @@
|
|
1
|
+
from datetime import datetime
|
2
|
+
from typing import Optional, Union, Literal, List, Any
|
3
|
+
from uuid import UUID
|
4
|
+
from maleo_foundation.models.enums import BaseEnums
|
5
|
+
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
6
|
+
|
7
|
+
class BaseGeneralTypes:
|
8
|
+
#* Any-related types
|
9
|
+
ListOfAny = List[Any]
|
10
|
+
OptionalAny = Optional[Any]
|
11
|
+
|
12
|
+
#* Boolean-related types
|
13
|
+
LiteralFalse = Literal[False]
|
14
|
+
LiteralTrue = Literal[True]
|
15
|
+
|
16
|
+
#* Float-related types
|
17
|
+
ListOfFloats = List[float]
|
18
|
+
OptionalFloat = Optional[float]
|
19
|
+
OptionalListOfFloats = Optional[List[float]]
|
20
|
+
|
21
|
+
#* Integer-related types
|
22
|
+
ListOfIntegers = List[int]
|
23
|
+
OptionalInteger = Optional[int]
|
24
|
+
OptionalListOfIntegers = Optional[List[int]]
|
25
|
+
|
26
|
+
#* String-related types
|
27
|
+
ListOfStrings = List[str]
|
28
|
+
OptionalString = Optional[str]
|
29
|
+
OptionalListOfStrings = Optional[List[str]]
|
30
|
+
|
31
|
+
#* Datetime-related types
|
32
|
+
OptionalDatetime = Optional[datetime]
|
33
|
+
|
34
|
+
#* UUID-related types
|
35
|
+
ListOfUUIDs = List[UUID]
|
36
|
+
OptionalUUID = Optional[UUID]
|
37
|
+
OptionalListOfUUIDs = Optional[List[UUID]]
|
38
|
+
|
39
|
+
#* Statuses-related types
|
40
|
+
ListOfStatuses = List[BaseEnums.StatusType]
|
41
|
+
OptionalListOfStatuses = Optional[List[BaseEnums.StatusType]]
|
42
|
+
|
43
|
+
#* Miscellanous types
|
44
|
+
IdentifierValue = Union[int, UUID, str]
|
@@ -0,0 +1,9 @@
|
|
1
|
+
from typing import List
|
2
|
+
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
3
|
+
|
4
|
+
class BaseParameterTypes:
|
5
|
+
#* DateFilter-related types
|
6
|
+
ListOfDateFilters = List[BaseGeneralSchemas.DateFilter]
|
7
|
+
|
8
|
+
#* SortColumn-related types
|
9
|
+
ListOfSortColumns = List[BaseGeneralSchemas.SortColumn]
|
@@ -21,9 +21,9 @@ maleo_foundation/models/__init__.py,sha256=Wh92XAduE1Sg9qi2GMhptyXig0fKcTS5AbGo3
|
|
21
21
|
maleo_foundation/models/enums.py,sha256=Ob2v312JxypHEq7hTKZKOV462FEeLkIjIhpx-YF6Jdw,2203
|
22
22
|
maleo_foundation/models/responses.py,sha256=1Rs3EflBJdsTC8PSbaOFbbTyxwRwK031eU3qLEj21sU,4215
|
23
23
|
maleo_foundation/models/schemas/__init__.py,sha256=Xj8Ahsqyra-fmEaVcGPok5GOOsPQlKcknHYMvbjvENA,277
|
24
|
-
maleo_foundation/models/schemas/general.py,sha256=
|
25
|
-
maleo_foundation/models/schemas/parameter.py,sha256=
|
26
|
-
maleo_foundation/models/schemas/result.py,sha256=
|
24
|
+
maleo_foundation/models/schemas/general.py,sha256=LYhwCyzRGoGi0RhDvyq_SLE9VdUqYMlzc1rfkuvUV_w,6786
|
25
|
+
maleo_foundation/models/schemas/parameter.py,sha256=r28P_-LIWIwTsQ9LdiBxJy3AjagC2JCFdvRM0NluKGk,1057
|
26
|
+
maleo_foundation/models/schemas/result.py,sha256=qiqp2FxkmpSh0erQ3nob5X6lpdK7bzjpw5GKDn4w8f0,1837
|
27
27
|
maleo_foundation/models/transfers/__init__.py,sha256=B8oCZHE3NTsrJ_rviSXaDsuc-gc25jpjuhJO40lpQiE,222
|
28
28
|
maleo_foundation/models/transfers/parameters/__init__.py,sha256=oKW4RPIEISISRjsJzD8lsCGY1HhZRTzshPpWHcJu86k,353
|
29
29
|
maleo_foundation/models/transfers/parameters/client.py,sha256=Q43A-Z7JPXcxb_v7iUKoA1_WV8AMdEaeSl9Z39WSF_8,2287
|
@@ -39,8 +39,10 @@ maleo_foundation/models/transfers/results/service/general.py,sha256=G4x-MhQI7Km9
|
|
39
39
|
maleo_foundation/models/transfers/results/service/query.py,sha256=Wj9GCWk7FrKP0EoK55vJcr9YJ42Lo24mLXbRk9j0IJw,2566
|
40
40
|
maleo_foundation/models/transfers/results/service/controllers/__init__.py,sha256=HZJWMy2dskzOCzLmp_UaL9rjbQ-sDMI7sd2bXb-4QOU,175
|
41
41
|
maleo_foundation/models/transfers/results/service/controllers/rest.py,sha256=bZ4NibT58aim6p3epFJ9ipR8Z54FkOuFx2GniK4CUfM,1114
|
42
|
-
maleo_foundation/models/types/__init__.py,sha256=
|
42
|
+
maleo_foundation/models/types/__init__.py,sha256=RVDgAANo9GayyPFh7BX9RHAJp_tkT5BCHMZc_s0mTNU,393
|
43
43
|
maleo_foundation/models/types/client.py,sha256=tZtuMI_4uLxEiOvuGrwznEzMpqt3EEb3Z4t_VwzVtI0,1578
|
44
|
+
maleo_foundation/models/types/general.py,sha256=1z7COx9bEBDkQL8MuAq6mpW3SRqMIZLn7znaTY3F6UQ,1291
|
45
|
+
maleo_foundation/models/types/parameter.py,sha256=TXZ3WHvtn8g6jOQY5k4h5GQQk_8e4unpg1Q7W1J3EY0,306
|
44
46
|
maleo_foundation/models/types/query.py,sha256=wq5bCbph19PjcpEuAh58B330jopSUG64KGsoi9SFuN4,1567
|
45
47
|
maleo_foundation/models/types/service.py,sha256=utK9TACldhE0WW75KN84F_9D-fM5l1xN5_3F6QUVfPs,1595
|
46
48
|
maleo_foundation/utils/__init__.py,sha256=tfgaHZI2PDgxEVSQztfnDMN5S6L5Y4FcK5v_Wkf5snE,245
|
@@ -48,7 +50,7 @@ maleo_foundation/utils/exceptions.py,sha256=mcvBwHm6uWpVQkPtO1T2j-GaTYEiyPOeGxiD
|
|
48
50
|
maleo_foundation/utils/logger.py,sha256=ICrFi0MxuAjDy8KTRL7pex1miwzZqZX-HHArgN3niJM,2453
|
49
51
|
maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
|
50
52
|
maleo_foundation/utils/formatter/case.py,sha256=TmvvlfzGdC_omMTB5vAa40TZBxQ3hnr-SYeo0M52Rlg,1352
|
51
|
-
maleo_foundation-0.0.
|
52
|
-
maleo_foundation-0.0.
|
53
|
-
maleo_foundation-0.0.
|
54
|
-
maleo_foundation-0.0.
|
53
|
+
maleo_foundation-0.0.24.dist-info/METADATA,sha256=oGKE0vwTdrCklaPnolSSxhNDl1TDQZ_ZHQ4beVAOrPs,3160
|
54
|
+
maleo_foundation-0.0.24.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
55
|
+
maleo_foundation-0.0.24.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
56
|
+
maleo_foundation-0.0.24.dist-info/RECORD,,
|
File without changes
|