All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 6s
Build on push / prepare (push) Successful in 9s
Build on push / core (push) Successful in 18s
Build on push / query (push) Successful in 19s
Build on push / dependency (push) Successful in 17s
Build on push / mail (push) Successful in 16s
Build on push / translation (push) Successful in 16s
Build on push / application (push) Successful in 18s
Build on push / database (push) Successful in 19s
Build on push / auth (push) Successful in 17s
Build on push / api (push) Successful in 14s
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
from cpl.application.abc import ApplicationABC
|
|
from cpl.auth.keycloak import KeycloakAdmin
|
|
from cpl.core.console import Console
|
|
from cpl.core.environment import Environment
|
|
from cpl.core.log import LoggerABC
|
|
from cpl.dependency import ServiceProvider
|
|
from cpl.dependency.typing import Modules
|
|
from model.city import City
|
|
from model.city_dao import CityDao
|
|
from model.user import User
|
|
from model.user_dao import UserDao
|
|
|
|
|
|
class Application(ApplicationABC):
|
|
def __init__(self, services: ServiceProvider, modules: Modules):
|
|
ApplicationABC.__init__(self, services, modules)
|
|
|
|
self._logger = services.get_service(LoggerABC)
|
|
|
|
async def test_daos(self):
|
|
userDao: UserDao = self._services.get_service(UserDao)
|
|
cityDao: CityDao = self._services.get_service(CityDao)
|
|
|
|
Console.write_line(await userDao.get_all())
|
|
|
|
if len(await cityDao.get_all()) == 0:
|
|
city_id = await cityDao.create(City(0, "Haren", "49733"))
|
|
await userDao.create(User(0, "NewUser", city_id))
|
|
|
|
Console.write_line(await userDao.get_all())
|
|
|
|
async def main(self):
|
|
self._logger.debug(f"Host: {Environment.get_host_name()}")
|
|
self._logger.debug(f"Environment: {Environment.get_environment()}")
|
|
|
|
await self.test_daos()
|
|
|
|
kc_admin: KeycloakAdmin = self._services.get_service(KeycloakAdmin)
|
|
x = kc_admin.get_users()
|
|
Console.write_line(x)
|