-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
|
|
|
|
||
@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) |
There was a problem hiding this comment.
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
apps/bamboohr/urls.py
Outdated
@@ -1,11 +1,12 @@ | |||
from django.urls import path | |||
|
|||
from .views import PostFolder, PostPackage, BambooHrConnection, BambooHrView, BambooHrConfigurationView, \ | |||
DisconnectView, SyncEmployeesView, HealthCheck | |||
DisconnectView, SyncEmployeesView, HealthCheck, WebhookAPIView |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WebhookCallbackAPIView
apps/bamboohr/signals.py
Outdated
instance.webhook_id = int(response['id']) | ||
instance.save() | ||
|
||
@receiver(pre_delete, sender=BambooHr) |
There was a problem hiding this comment.
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
|
|
|
apps/bamboohr/views.py
Outdated
if isinstance(connection, Response): | ||
return connection | ||
|
||
webhook_id = request.data['webhook_id'] |
There was a problem hiding this comment.
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
apps/bamboohr/views.py
Outdated
@@ -48,6 +48,24 @@ def get(self, request, *args, **kwargs): | |||
status=status.HTTP_404_NOT_FOUND | |||
) | |||
|
|||
|
|||
class WebhookAPIView(generics.CreateAPIView): |
There was a problem hiding this comment.
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
|
|
* 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
No description provided.