Fixed cpl query update

This commit is contained in:
Sven Heidemann 2022-12-17 16:17:14 +01:00
parent b25b75e382
commit bcf71a26f0
4 changed files with 8 additions and 8 deletions

View File

@ -18,7 +18,7 @@
"Dependencies": [ "Dependencies": [
"cpl-core==2022.12.0", "cpl-core==2022.12.0",
"cpl-translation==2022.10.0.post2", "cpl-translation==2022.10.0.post2",
"cpl-query==2022.12.1.post1", "cpl-query==2022.12.2",
"cpl-discord==2022.12.0", "cpl-discord==2022.12.0",
"Flask==2.2.2", "Flask==2.2.2",
"Flask-Classful==0.14.2", "Flask-Classful==0.14.2",

View File

@ -46,14 +46,14 @@ class AuthController:
@Route.authorize(role=AuthRoleEnum.admin) @Route.authorize(role=AuthRoleEnum.admin)
async def get_all_users(self) -> Response: async def get_all_users(self) -> Response:
result = await self._auth_service.get_all_auth_users_async() result = await self._auth_service.get_all_auth_users_async()
return jsonify(result.select(lambda x: x.to_dict())) return jsonify(result.select(lambda x: x.to_dict()).to_list())
@Route.post(f'{BasePath}/users/get/filtered') @Route.post(f'{BasePath}/users/get/filtered')
@Route.authorize(role=AuthRoleEnum.admin) @Route.authorize(role=AuthRoleEnum.admin)
async def get_filtered_users(self) -> Response: async def get_filtered_users(self) -> Response:
dto: AuthUserSelectCriteria = JSONProcessor.process(AuthUserSelectCriteria, request.get_json(force=True, silent=True)) dto: AuthUserSelectCriteria = JSONProcessor.process(AuthUserSelectCriteria, request.get_json(force=True, silent=True))
result = await self._auth_service.get_filtered_auth_users_async(dto) result = await self._auth_service.get_filtered_auth_users_async(dto)
result.result = result.result.select(lambda x: x.to_dict()) result.result = result.result.select(lambda x: x.to_dict()).to_list()
return jsonify(result.to_dict()) return jsonify(result.to_dict())
@Route.get(f'{BasePath}/users/get/<email>') @Route.get(f'{BasePath}/users/get/<email>')

View File

@ -40,14 +40,14 @@ class ServerController:
@Route.authorize(role=AuthRoleEnum.admin) @Route.authorize(role=AuthRoleEnum.admin)
async def get_all_servers(self) -> Response: async def get_all_servers(self) -> Response:
result = await self._discord_service.get_all_servers() result = await self._discord_service.get_all_servers()
result = result.select(lambda x: x.to_dict()) result = result.select(lambda x: x.to_dict()).to_list()
return jsonify(result) return jsonify(result)
@Route.get(f'{BasePath}/get/servers-by-user') @Route.get(f'{BasePath}/get/servers-by-user')
@Route.authorize @Route.authorize
async def get_all_servers_by_user(self) -> Response: async def get_all_servers_by_user(self) -> Response:
result = await self._discord_service.get_all_servers_by_user() result = await self._discord_service.get_all_servers_by_user()
result = result.select(lambda x: x.to_dict()) result = result.select(lambda x: x.to_dict()).to_list()
return jsonify(result) return jsonify(result)
@Route.post(f'{BasePath}/get/filtered') @Route.post(f'{BasePath}/get/filtered')
@ -55,11 +55,11 @@ class ServerController:
async def get_filtered_servers(self) -> Response: async def get_filtered_servers(self) -> Response:
dto: ServerSelectCriteria = JSONProcessor.process(ServerSelectCriteria, request.get_json(force=True, silent=True)) dto: ServerSelectCriteria = JSONProcessor.process(ServerSelectCriteria, request.get_json(force=True, silent=True))
result = await self._discord_service.get_filtered_servers_async(dto) result = await self._discord_service.get_filtered_servers_async(dto)
result.result = result.result.select(lambda x: x.to_dict()) result.result = result.result.select(lambda x: x.to_dict()).to_list()
return jsonify(result.to_dict()) return jsonify(result.to_dict())
@Route.get(f'{BasePath}/get/<id>') @Route.get(f'{BasePath}/get/<id>')
@Route.authorize @Route.authorize
async def get_server_by_id(self, id: int) -> Response: async def get_server_by_id(self, id: int) -> Response:
result = await self._discord_service.get_server_by_id_async(id) result = await self._discord_service.get_server_by_id_async(id).to_list()
return jsonify(result.to_dict()) return jsonify(result.to_dict())

View File

@ -88,7 +88,7 @@ class LevelSeeder(DataSeederABC):
if levels.where(lambda l: l.name == role.name).count() == 0: if levels.where(lambda l: l.name == role.name).count() == 0:
continue continue
new_position = position_above_levels - (levels.index(levels.where(lambda l: l.name == role.name).single()) + 1) new_position = position_above_levels - (levels.index_of(levels.where(lambda l: l.name == role.name).single()) + 1)
if new_position <= 0: if new_position <= 0:
new_position = 1 new_position = 1
try: try: