maleo-foundation 0.0.55__py3-none-any.whl → 0.0.57__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.
@@ -4,38 +4,37 @@ from uuid import uuid4
4
4
  from maleo_foundation.enums import BaseEnums
5
5
  from maleo_foundation.utils.formatter.case import CaseFormatter
6
6
 
7
- Base = declarative_base() #* Correct way to define a declarative base
8
-
9
7
  class DatabaseManager:
10
- class Base(Base): #* Inheriting from declarative_base
11
- __abstract__ = True #* Ensures this class is not treated as a table itself
8
+ class BaseMixin:
9
+ __abstract__ = True
12
10
 
13
11
  @declared_attr
14
12
  def __tablename__(cls) -> str:
15
- """Automatically generates table name (in snake_case) based on class name."""
16
13
  return CaseFormatter.to_snake_case(cls.__name__)
17
14
 
18
15
  #* ----- ----- Common columns definition ----- ----- *#
19
16
 
20
17
  #* Identifiers
21
- id = Column(name="id", type_=Integer, primary_key=True)
22
- uuid = Column(name="uuid", type_=UUID, default=uuid4, unique=True, nullable=False)
18
+ id = Column(Integer, primary_key=True)
19
+ uuid = Column(UUID, default=uuid4, unique=True, nullable=False)
23
20
 
24
21
  #* Timestamps
25
- created_at = Column(name="created_at", type_=TIMESTAMP(timezone=True), server_default=func.now(), nullable=False)
26
- updated_at = Column(name="updated_at", type_=TIMESTAMP(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False)
27
- deleted_at = Column(name="deleted_at", type_=TIMESTAMP(timezone=True))
28
- restored_at = Column(name="restored_at", type_=TIMESTAMP(timezone=True))
29
- deactivated_at = Column(name="deactivated_at", type_=TIMESTAMP(timezone=True))
30
- activated_at = Column(name="activated_at", type_=TIMESTAMP(timezone=True), server_default=func.now(), nullable=False)
22
+ created_at = Column(TIMESTAMP(timezone=True), server_default=func.now(), nullable=False)
23
+ updated_at = Column(TIMESTAMP(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False)
24
+ deleted_at = Column(TIMESTAMP(timezone=True))
25
+ restored_at = Column(TIMESTAMP(timezone=True))
26
+ deactivated_at = Column(TIMESTAMP(timezone=True))
27
+ activated_at = Column(TIMESTAMP(timezone=True), server_default=func.now(), nullable=False)
31
28
 
32
29
  #* Statuses
33
- status = Column(name="status", type_=Enum(BaseEnums.StatusType, name="statustype"), default=BaseEnums.StatusType.ACTIVE, nullable=False)
30
+ status = Column(Enum(BaseEnums.StatusType, name="statustype"), default=BaseEnums.StatusType.ACTIVE, nullable=False)
31
+
32
+ Base = declarative_base() #* Correct way to define a declarative base
34
33
 
35
34
  #* Explicitly define the type of metadata
36
35
  metadata:MetaData = Base.metadata
37
36
 
38
- @staticmethod
39
- def initialize(engine: Engine):
37
+ @classmethod
38
+ def initialize(cls, engine:Engine):
40
39
  """Creates the database tables if they do not exist."""
41
- DatabaseManager.metadata.create_all(engine)
40
+ cls.metadata.create_all(engine)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.0.55
3
+ Version: 0.0.57
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -14,7 +14,7 @@ maleo_foundation/clients/google/cloud/storage.py,sha256=y_HAsbcGSnu5sxZPxaQWFWvO
14
14
  maleo_foundation/clients/utils/__init__.py,sha256=hChEGABHH4tOFxPRcpxmlhkM9PgF18M7wXapH88hpu4,131
15
15
  maleo_foundation/clients/utils/logger.py,sha256=QhxljzrvNY_gXAHCqaOUJJAgwvvcE9v3IQK6AWYxzM4,1144
16
16
  maleo_foundation/db/__init__.py,sha256=fFqGxpsiowiws70AqOfcOWFhwaahfOj9_05JSJ0iRaE,107
17
- maleo_foundation/db/database.py,sha256=NroYq_nCO4Je869wPB711b11UGMhbxw8GRIpWppYan4,2057
17
+ maleo_foundation/db/database.py,sha256=I0dJ4DPWOxlgoARJa6dYtff37NswOj3oPICvP41hmgc,1653
18
18
  maleo_foundation/db/engine.py,sha256=kw2SMMiWy5KARquh4TLk7v6HwlHW97lUIUvqdFbhNxk,1600
19
19
  maleo_foundation/db/session.py,sha256=tI13DJ6rLo8FOpSIFZrmD4dbuxY_c0RTjwEGb76ZOo0,2681
20
20
  maleo_foundation/expanded_types/__init__.py,sha256=RohoIQCiMvo2g6Jacq2dlqNXg3WLmRc-TD8nvMsyDKs,275
@@ -52,7 +52,7 @@ maleo_foundation/utils/logger.py,sha256=978P57JOhGR-WIu7xdPXBIwd3JrfLLA8WerVzxhE
52
52
  maleo_foundation/utils/query.py,sha256=qKNcjf5J7_Q7NjA79BO6_TpZVdYcF8YIO68F9M501ew,4398
53
53
  maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
54
54
  maleo_foundation/utils/formatter/case.py,sha256=TmvvlfzGdC_omMTB5vAa40TZBxQ3hnr-SYeo0M52Rlg,1352
55
- maleo_foundation-0.0.55.dist-info/METADATA,sha256=HMw5sDv9M1nkfNOjFpfFhKwiVTzRuflTarLdBC-Tckw,3160
56
- maleo_foundation-0.0.55.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
57
- maleo_foundation-0.0.55.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
58
- maleo_foundation-0.0.55.dist-info/RECORD,,
55
+ maleo_foundation-0.0.57.dist-info/METADATA,sha256=GQr5GN7ancjf-TywIe8Zgp6P9KybR_gJMIQeBqG9hDs,3160
56
+ maleo_foundation-0.0.57.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
57
+ maleo_foundation-0.0.57.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
58
+ maleo_foundation-0.0.57.dist-info/RECORD,,