fix things for docker compose

This commit is contained in:
Gardient
2021-12-19 20:27:13 +02:00
parent fe424e3fa2
commit c9f07df262
8 changed files with 67 additions and 14 deletions

View File

@@ -35,11 +35,11 @@ def get_list(exchange=None, target=None):
@use_kwargs(registration_schema)
@marshal_with(registration_schema)
def create(name, routing_key, targets):
target_ids = [t.id for t in targets]
target_ids = [t["id"] for t in targets]
db_targets = Target.query.filter(Target.id.in_(target_ids))
if len(db_targets) != len(targets):
xchange_ids = [t.id for t in db_targets]
not_found = ','.join([f'{t.name}({t.id})' for t in targets if t.id not in xchange_ids])
xchange_ids = [t["id"] for t in db_targets]
not_found = ','.join([f'{t["name"]}({t["id"]})' for t in targets if t["id"] not in xchange_ids])
raise BadRequestException(f"the target {not_found} could not be found")
registration = Registration(name=name, token=routing_key, targets=db_targets)
registration.save()