def insert_system(form: FlaskForm) -> Entity: entity = Entity.insert('reference_system', form.name.data, form.description.data) Db.insert_system({ 'entity_id': entity.id, 'name': entity.name, 'website_url': form.website_url.data if form.website_url.data else None, 'resolver_url': form.resolver_url.data if form.resolver_url.data else None}) return ReferenceSystem.get_all()[entity.id]
def insert_system(data: dict[str, str]) -> Entity: entity = Entity.insert( 'reference_system', data['name'], data['description']) Db.insert_system({ 'entity_id': entity.id, 'name': entity.name, 'website_url': data['website_url'] if data['website_url'] else None, 'resolver_url': data['resolver_url'] if data['resolver_url'] else None}) return ReferenceSystem.get_all()[entity.id]