maleo-foundation 0.0.6__tar.gz → 0.0.8__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.
Files changed (59) hide show
  1. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/PKG-INFO +1 -1
  2. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/schemas/general.py +35 -1
  3. maleo_foundation-0.0.8/maleo_foundation/models/schemas/result.py +41 -0
  4. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/results/service/query.py +30 -4
  5. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation.egg-info/PKG-INFO +1 -1
  6. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/pyproject.toml +1 -1
  7. maleo_foundation-0.0.6/maleo_foundation/models/schemas/result.py +0 -89
  8. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/README.md +0 -0
  9. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/__init__.py +0 -0
  10. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/clients/__init__.py +0 -0
  11. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/clients/general/__init__.py +0 -0
  12. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/clients/general/http.py +0 -0
  13. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/clients/google/__init__.py +0 -0
  14. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/clients/google/cloud/__init__.py +0 -0
  15. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/clients/google/cloud/logging.py +0 -0
  16. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/clients/google/cloud/secret.py +0 -0
  17. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/clients/google/cloud/storage.py +0 -0
  18. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/constants.py +0 -0
  19. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/controller.py +0 -0
  20. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/db/__init__.py +0 -0
  21. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/db/database.py +0 -0
  22. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/db/engine.py +0 -0
  23. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/db/session.py +0 -0
  24. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/middlewares/__init__.py +0 -0
  25. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/middlewares/base.py +0 -0
  26. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/middlewares/cors.py +0 -0
  27. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/__init__.py +0 -0
  28. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/enums.py +0 -0
  29. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/responses.py +0 -0
  30. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/schemas/__init__.py +0 -0
  31. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/schemas/parameter.py +0 -0
  32. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/__init__.py +0 -0
  33. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/parameters/__init__.py +0 -0
  34. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/parameters/client.py +0 -0
  35. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/parameters/general.py +0 -0
  36. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/parameters/service.py +0 -0
  37. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/results/__init__.py +0 -0
  38. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/results/client/__init__.py +0 -0
  39. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/results/client/controllers/__init__.py +0 -0
  40. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/results/client/controllers/http.py +0 -0
  41. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/results/client/service.py +0 -0
  42. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/results/service/__init__.py +0 -0
  43. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/results/service/controllers/__init__.py +0 -0
  44. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/results/service/controllers/rest.py +0 -0
  45. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/transfers/results/service/general.py +0 -0
  46. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/types/__init__.py +0 -0
  47. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/types/client.py +0 -0
  48. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/types/query.py +0 -0
  49. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/models/types/service.py +0 -0
  50. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/utils/__init__.py +0 -0
  51. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/utils/exceptions.py +0 -0
  52. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/utils/formatter/__init__.py +0 -0
  53. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/utils/formatter/case.py +0 -0
  54. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation/utils/logger.py +0 -0
  55. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation.egg-info/SOURCES.txt +0 -0
  56. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation.egg-info/dependency_links.txt +0 -0
  57. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation.egg-info/requires.txt +0 -0
  58. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/maleo_foundation.egg-info/top_level.txt +0 -0
  59. {maleo_foundation-0.0.6 → maleo_foundation-0.0.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.0.6
3
+ Version: 0.0.8
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -1,7 +1,7 @@
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, Any
4
+ from typing import Optional, Union, Any
5
5
  from uuid import UUID
6
6
  from maleo_foundation.models.enums import BaseEnums
7
7
  from maleo_foundation.constants import REFRESH_TOKEN_DURATION_DAYS, ACCESS_TOKEN_DURATION_MINUTES
@@ -48,6 +48,40 @@ class BaseGeneralSchemas:
48
48
 
49
49
  class KeyPair(PublicKey, PrivateKey): pass
50
50
 
51
+ class Identifiers(BaseModel):
52
+ id:int = Field(..., ge=1, description="Data's ID, must be >= 1.")
53
+ uuid:UUID = Field(..., description="Data's UUID.")
54
+
55
+ @field_serializer('uuid')
56
+ def serialize_uuid(self, value:UUID, info:FieldSerializationInfo) -> str:
57
+ """Serializes UUID to a hex string."""
58
+ return str(value)
59
+
60
+ class Timestamps(BaseModel):
61
+ created_at:datetime = Field(..., description="Data's created_at timestamp")
62
+ updated_at:datetime = Field(..., description="Data's updated_at timestamp")
63
+ deleted_at:Optional[datetime] = Field(..., description="Data's deleted_at timestamp")
64
+ restored_at:Optional[datetime] = Field(..., description="Data's restored_at timestamp")
65
+ deactivated_at:Optional[datetime] = Field(..., description="Data's deactivated_at timestamp")
66
+ activated_at:datetime = Field(..., description="Data's activated_at timestamp")
67
+
68
+ @field_serializer('created_at', 'updated_at', 'deleted_at', 'restored_at', 'deactivated_at', 'activated_at')
69
+ def serialize_timestamps(self, value:Union[datetime, date], info:FieldSerializationInfo) -> str:
70
+ """Serializes datetime/date fields to ISO format."""
71
+ return value.isoformat()
72
+
73
+ class Status(BaseModel):
74
+ status:BaseEnums.StatusType = Field(..., description="Data's status")
75
+
76
+ class Order(BaseModel):
77
+ order:Optional[int] = Field(..., description="Data's order")
78
+
79
+ class Key(BaseModel):
80
+ key:str = Field(..., description="Data's key")
81
+
82
+ class Name(BaseModel):
83
+ name:str = Field(..., description="Data's name")
84
+
51
85
  class TokenPayload(BaseModel):
52
86
  t:BaseEnums.TokenType = Field(..., description="Token Type")
53
87
  sr:UUID = Field(..., description="System role")
@@ -0,0 +1,41 @@
1
+ from pydantic import BaseModel, Field
2
+ from typing import Literal, Optional, Any
3
+ from maleo_foundation.models.schemas.general import BaseGeneralSchemas
4
+
5
+ class BaseResultSchemas:
6
+ class Base(BaseModel):
7
+ success:bool = Field(..., description="Success status")
8
+ code:Optional[str] = Field(None, description="Optional result code")
9
+ message:Optional[str] = Field(None, description="Optional message")
10
+ description:Optional[str] = Field(None, description="Optional description")
11
+ data:Any = Field(..., description="Data")
12
+ other:Optional[Any] = Field(None, description="Optional other information")
13
+
14
+ #* ----- ----- ----- Intermediary ----- ----- ----- *#
15
+ class Fail(Base):
16
+ success:Literal[False] = Field(False, description="Success status")
17
+ data:None = Field(None, description="No data")
18
+
19
+ class Success(Base):
20
+ success:Literal[True] = Field(True, description="Success status")
21
+ data:Any = Field(..., description="Data")
22
+
23
+ #* ----- ----- ----- Derived ----- ----- ----- *#
24
+ class NoData(Success):
25
+ success:Literal[True] = Field(True, description="Success status")
26
+ data:None = Field(None, description="No data")
27
+
28
+ class SingleData(Success):
29
+ success:Literal[True] = Field(True, description="Success status")
30
+ data:Any = Field(..., description="Fetched single data")
31
+
32
+ class UnpaginatedMultipleData(Success):
33
+ success:Literal[True] = Field(True, description="Success status")
34
+ data:list[Any] = Field(..., description="Unpaginated multiple data")
35
+
36
+ class PaginatedMultipleData(
37
+ UnpaginatedMultipleData,
38
+ BaseGeneralSchemas.SimplePagination
39
+ ):
40
+ total_data:int = Field(..., description="Total data count")
41
+ pagination:BaseGeneralSchemas.ExtendedPagination = Field(..., description="Pagination metadata")
@@ -1,21 +1,47 @@
1
1
  from __future__ import annotations
2
- from pydantic import model_validator
2
+ from datetime import datetime, date
3
+ from pydantic import FieldSerializationInfo, field_validator, field_serializer, model_validator
4
+ from uuid import UUID
5
+ from typing import Any
3
6
  from maleo_foundation.models.schemas.general import BaseGeneralSchemas
4
7
  from maleo_foundation.models.schemas.result import BaseResultSchemas
5
8
 
6
9
  class BaseServiceQueryResultsTransfers:
10
+ class Row(
11
+ BaseGeneralSchemas.Status,
12
+ BaseGeneralSchemas.Timestamps,
13
+ BaseGeneralSchemas.Identifiers
14
+ ):
15
+ @field_validator('*', mode="before")
16
+ def set_none(cls, values):
17
+ if isinstance(values, str) and (values == "" or len(values) == 0):
18
+ return None
19
+ return values
20
+
21
+ @field_serializer('*')
22
+ def serialize_fields(self, value, info:FieldSerializationInfo) -> Any:
23
+ """Serializes all unique-typed fields."""
24
+ if isinstance(value, UUID):
25
+ return str(value)
26
+ if isinstance(value, datetime) or isinstance(value, date):
27
+ return value.isoformat()
28
+ return value
29
+
30
+ class Config:
31
+ from_attributes=True
32
+
7
33
  class Fail(BaseResultSchemas.Fail): pass
8
34
 
9
35
  class NoData(BaseResultSchemas.NoData): pass
10
36
 
11
37
  class SingleData(BaseResultSchemas.SingleData):
12
- data:BaseResultSchemas.Row
38
+ data:BaseServiceQueryResultsTransfers.Row
13
39
 
14
40
  class UnpaginatedMultipleData(BaseResultSchemas.UnpaginatedMultipleData):
15
- data:list[BaseResultSchemas.Row]
41
+ data:list[BaseServiceQueryResultsTransfers.Row]
16
42
 
17
43
  class PaginatedMultipleData(BaseResultSchemas.PaginatedMultipleData):
18
- data:list[BaseResultSchemas.Row]
44
+ data:list[BaseServiceQueryResultsTransfers.Row]
19
45
 
20
46
  @model_validator(mode="before")
21
47
  @classmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.0.6
3
+ Version: 0.0.8
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maleo_foundation"
7
- version = "0.0.6"
7
+ version = "0.0.8"
8
8
  description = "Foundation package for Maleo"
9
9
  authors = [
10
10
  { name = "Agra Bima Yuda", email = "agra@nexmedis.com" }
@@ -1,89 +0,0 @@
1
- from datetime import datetime, date
2
- from pydantic import BaseModel, FieldSerializationInfo, Field, field_serializer, field_validator
3
- from typing import Literal, Optional, Union, Any
4
- from uuid import UUID
5
- from maleo_foundation.models.enums import BaseEnums
6
- from maleo_foundation.models.schemas.general import BaseGeneralSchemas
7
-
8
- class BaseResultSchemas:
9
- class Identifiers(BaseModel):
10
- id:int = Field(..., ge=1, description="Data's ID, must be >= 1.")
11
- uuid:UUID = Field(..., description="Data's UUID.")
12
-
13
- @field_serializer('uuid')
14
- def serialize_uuid(self, value:UUID, info:FieldSerializationInfo) -> str:
15
- """Serializes UUID to a hex string."""
16
- return str(value)
17
-
18
- class Timestamps(BaseModel):
19
- created_at:datetime = Field(..., description="Data's created_at timestamp")
20
- updated_at:datetime = Field(..., description="Data's updated_at timestamp")
21
- deleted_at:Optional[datetime] = Field(..., description="Data's deleted_at timestamp")
22
- restored_at:Optional[datetime] = Field(..., description="Data's restored_at timestamp")
23
- deactivated_at:Optional[datetime] = Field(..., description="Data's deactivated_at timestamp")
24
- activated_at:datetime = Field(..., description="Data's activated_at timestamp")
25
-
26
- @field_serializer('created_at', 'updated_at', 'deleted_at', 'restored_at', 'deactivated_at', 'activated_at')
27
- def serialize_timestamps(self, value:Union[datetime, date], info:FieldSerializationInfo) -> str:
28
- """Serializes datetime/date fields to ISO format."""
29
- return value.isoformat()
30
-
31
- class Status(BaseModel):
32
- status:BaseEnums.StatusType = Field(..., description="Data's status")
33
-
34
- class Row(Status, Timestamps, Identifiers):
35
- @field_validator('*', mode="before")
36
- def set_none(cls, values):
37
- if isinstance(values, str) and (values == "" or len(values) == 0):
38
- return None
39
- return values
40
-
41
- @field_serializer('*')
42
- def serialize_fields(self, value, info:FieldSerializationInfo) -> Any:
43
- """Serializes all unique-typed fields."""
44
- if isinstance(value, UUID):
45
- return str(value)
46
- if isinstance(value, datetime) or isinstance(value, date):
47
- return value.isoformat()
48
- return value
49
-
50
- class Config:
51
- from_attributes=True
52
-
53
- #* ----- ----- ----- Base ----- ----- ----- *#
54
- class Base(BaseModel):
55
- success:bool = Field(..., description="Success status")
56
- code:Optional[str] = Field(None, description="Optional result code")
57
- message:Optional[str] = Field(None, description="Optional message")
58
- description:Optional[str] = Field(None, description="Optional description")
59
- data:Any = Field(..., description="Data")
60
- other:Optional[Any] = Field(None, description="Optional other information")
61
-
62
- #* ----- ----- ----- Intermediary ----- ----- ----- *#
63
- class Fail(Base):
64
- success:Literal[False] = Field(False, description="Success status")
65
- data:None = Field(None, description="No data")
66
-
67
- class Success(Base):
68
- success:Literal[True] = Field(True, description="Success status")
69
- data:Any = Field(..., description="Data")
70
-
71
- #* ----- ----- ----- Derived ----- ----- ----- *#
72
- class NoData(Success):
73
- success:Literal[True] = Field(True, description="Success status")
74
- data:None = Field(None, description="No data")
75
-
76
- class SingleData(Success):
77
- success:Literal[True] = Field(True, description="Success status")
78
- data:Any = Field(..., description="Fetched single data")
79
-
80
- class UnpaginatedMultipleData(Success):
81
- success:Literal[True] = Field(True, description="Success status")
82
- data:list[Any] = Field(..., description="Unpaginated multiple data")
83
-
84
- class PaginatedMultipleData(
85
- UnpaginatedMultipleData,
86
- BaseGeneralSchemas.SimplePagination
87
- ):
88
- total_data:int = Field(..., description="Total data count")
89
- pagination:BaseGeneralSchemas.ExtendedPagination = Field(..., description="Pagination metadata")