Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and Create Employee on Webhook trigger from bamboohr #124

Merged
merged 9 commits into from
Jan 3, 2024

Conversation

Ashutosh619-sudo
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Jan 2, 2024

Tests Skipped Failures Errors Time
45 1 💤 2 ❌ 0 🔥 2.774s ⏱️

Copy link

github-actions bot commented Jan 2, 2024

Tests Skipped Failures Errors Time
45 1 💤 2 ❌ 0 🔥 2.767s ⏱️

Copy link

github-actions bot commented Jan 2, 2024

Tests Skipped Failures Errors Time
45 1 💤 0 ❌ 8 🔥 19.027s ⏱️


@receiver(post_save, sender=BambooHr)
def run_post_save_bamboohr_triggers(sender, instance: BambooHr, **kwargs):
bamboohrsdk = BambooHrSDK(api_token=instance.api_token, sub_domain=instance.sub_domain)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do all these only when webhook_id is null

@@ -1,11 +1,12 @@
from django.urls import path

from .views import PostFolder, PostPackage, BambooHrConnection, BambooHrView, BambooHrConfigurationView, \
DisconnectView, SyncEmployeesView, HealthCheck
DisconnectView, SyncEmployeesView, HealthCheck, WebhookAPIView
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebhookCallbackAPIView

instance.webhook_id = int(response['id'])
instance.save()

@receiver(pre_delete, sender=BambooHr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we delete bamboohr anywhere. This logic can be tied to the disconnect/ endpoint

Copy link

github-actions bot commented Jan 2, 2024

Tests Skipped Failures Errors Time
45 1 💤 0 ❌ 8 🔥 8.619s ⏱️

Copy link

github-actions bot commented Jan 3, 2024

Tests Skipped Failures Errors Time
45 1 💤 2 ❌ 1 🔥 3.493s ⏱️

Copy link

github-actions bot commented Jan 3, 2024

Tests Skipped Failures Errors Time
45 1 💤 2 ❌ 1 🔥 2.991s ⏱️

if isinstance(connection, Response):
return connection

webhook_id = request.data['webhook_id']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read it from table since we have access for it, need not depend on client

@@ -48,6 +48,24 @@ def get(self, request, *args, **kwargs):
status=status.HTTP_404_NOT_FOUND
)


class WebhookAPIView(generics.CreateAPIView):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebhookCallbackAPIView, match class name with url

Copy link

github-actions bot commented Jan 3, 2024

Tests Skipped Failures Errors Time
45 1 💤 2 ❌ 1 🔥 3.996s ⏱️

Copy link

github-actions bot commented Jan 3, 2024

Tests Skipped Failures Errors Time
45 1 💤 0 ❌ 8 🔥 6.790s ⏱️

@Ashutosh619-sudo Ashutosh619-sudo merged commit 862903d into refresh_employees Jan 3, 2024
1 check failed
Ashutosh619-sudo added a commit that referenced this pull request Jan 3, 2024
* API view added for refreshing employees from bamboohr

* comment changes

* minor change

* bug fixed and minor changes

* Update and Create Employee on Webhook trigger from bamboohr (#124)

* Update Create Employee on Webhook trigger

* tested and bug fix

* create and delete webhook added

* comment resolved

* fixed and tested

* minor changes

* comment resolved

* comment resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants