From 5c466335cc6f6ac240fa85e27211ef409f505130 Mon Sep 17 00:00:00 2001 From: Abdellahitech Date: Wed, 15 Jan 2025 22:48:58 +0100 Subject: [PATCH] fix: add sending comments to bullhorn --- .../v1/connectors/bullhorn/connector.py | 13 +++++++++++++ .../v1/connectors/bullhorn/warehouse.py | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/src/hrflow_connectors/v1/connectors/bullhorn/connector.py b/src/hrflow_connectors/v1/connectors/bullhorn/connector.py index 8a1cd9c8..17f8912b 100644 --- a/src/hrflow_connectors/v1/connectors/bullhorn/connector.py +++ b/src/hrflow_connectors/v1/connectors/bullhorn/connector.py @@ -383,9 +383,21 @@ def profile_format(data: BullhornProfile) -> t.Dict: def format_application(data: HrFlowProfile) -> t.Dict: info = data.get("info") or {} + metadatas = data.get("metadatas") or [] + attachments = ( [data["attachments"][0]] if data.get("attachments") is not None else [] ) + + comment = next( + ( + metadata["value"] + for metadata in metadatas + if metadata.get("name") == "comment" + ), + None, + ) + profile = { "firstName": info.get("first_name"), "lastName": info.get("last_name"), @@ -393,6 +405,7 @@ def format_application(data: HrFlowProfile) -> t.Dict: "address": get_location(info), "email": info.get("email"), "mobile": info.get("phone"), + "comment": comment, } attachment_list = get_attachments( diff --git a/src/hrflow_connectors/v1/connectors/bullhorn/warehouse.py b/src/hrflow_connectors/v1/connectors/bullhorn/warehouse.py index aa8db8c1..bd2595f4 100644 --- a/src/hrflow_connectors/v1/connectors/bullhorn/warehouse.py +++ b/src/hrflow_connectors/v1/connectors/bullhorn/warehouse.py @@ -250,6 +250,7 @@ def write_application( adapter.info(f"connexion info {params}, rest_url: {rest_url}") for profile in profiles: + comment = profile.pop("comment", None) if parameters.candidate_id: candidate_id = parameters.candidate_id if not parameters.candidate_id: @@ -358,6 +359,10 @@ def write_application( "source": parameters.source, "dateWebResponse": int(time.time() * 1000), } + + if comment: + job_submission_payload["comments"] = comment + adapter.info("Creating or updating if candidate jobSubmission") job_submission_response = create_or_update_entity( "JobSubmission",