Module dependencies as static var
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 6s
Build on push / prepare (push) Successful in 10s
Build on push / query (push) Successful in 19s
Build on push / core (push) Successful in 20s
Build on push / dependency (push) Successful in 17s
Build on push / application (push) Successful in 15s
Build on push / database (push) Successful in 16s
Build on push / mail (push) Successful in 18s
Build on push / translation (push) Successful in 22s
Build on push / auth (push) Successful in 18s
Build on push / api (push) Successful in 17s

This commit is contained in:
2025-09-26 08:46:30 +02:00
parent d05d947d54
commit 56a16cbeba
15 changed files with 112 additions and 103 deletions

View File

@@ -1,16 +1,11 @@
from cpl.core.errors import module_dependency_error
from cpl.database.model.server_type import ServerType
from cpl.dependency.module import Module, TModule
from cpl.database.mysql.mysql_module import MySQLModule
from cpl.database.postgres.postgres_module import PostgresModule
from cpl.dependency.module import Module
from cpl.dependency.service_collection import ServiceCollection
class DatabaseModule(Module):
@staticmethod
def dependencies() -> list[TModule]:
if not ServerType.has_server_type:
module_dependency_error(__name__, "MySQLModule or PostgresModule")
return []
dependencies = [(MySQLModule, PostgresModule)]
@staticmethod
def register(collection: ServiceCollection):

View File

@@ -1,13 +1,11 @@
from cpl.core.configuration.configuration import Configuration
from cpl.database.model.server_type import ServerTypes, ServerType
from cpl.dependency.module import Module, TModule
from cpl.dependency.module import Module
from cpl.dependency.service_collection import ServiceCollection
class MySQLModule(Module):
@staticmethod
def dependencies() -> list[TModule]:
return []
dependencies = []
@staticmethod
def register(collection: ServiceCollection):

View File

@@ -1,14 +1,11 @@
from cpl.core.configuration.configuration import Configuration
from cpl.database.database_module import DatabaseModule
from cpl.database.model.server_type import ServerTypes, ServerType
from cpl.dependency.module import Module, TModule
from cpl.dependency.module import Module
from cpl.dependency.service_collection import ServiceCollection
class PostgresModule(Module):
@staticmethod
def dependencies() -> list[TModule]:
return [DatabaseModule]
dependencies = []
@staticmethod
def register(collection: ServiceCollection):