chore: api and webhook refactor (#2861)
* chore: bug fix * dev: changes in api endpoints for invitations and inbox * chore: improvements * dev: update webhook send * dev: webhook validation and fix webhook flow for app * dev: error messages for deactivation * chore: api fixes * dev: update webhook and workspace leave * chore: issue comment * dev: default values for environment variables * dev: make the user active if he was already part of project member * chore: webhook cycle and module event * dev: disable ssl for emails * dev: webhooks restructuring * dev: updated webhook configuration * dev: webhooks * dev: state get object * dev: update workspace slug validation * dev: remove deactivation flag if max retries exceeded --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
This commit is contained in:
parent
c305cf2c72
commit
34e6ef0d8d
45 changed files with 811 additions and 270 deletions
|
|
@ -43,20 +43,25 @@ class TimezoneMixin:
|
|||
|
||||
class WebhookMixin:
|
||||
webhook_event = None
|
||||
bulk = False
|
||||
|
||||
def finalize_response(self, request, response, *args, **kwargs):
|
||||
response = super().finalize_response(request, response, *args, **kwargs)
|
||||
|
||||
# Check for the case should webhook be sent
|
||||
if (
|
||||
self.webhook_event
|
||||
and self.request.method in ["POST", "PATCH", "DELETE"]
|
||||
and response.status_code in [200, 201, 204]
|
||||
):
|
||||
# Push the object to delay
|
||||
send_webhook.delay(
|
||||
event=self.webhook_event,
|
||||
event_data=json.dumps(response.data, cls=DjangoJSONEncoder),
|
||||
payload=response.data,
|
||||
kw=self.kwargs,
|
||||
action=self.request.method,
|
||||
slug=self.workspace_slug,
|
||||
bulk=self.bulk,
|
||||
)
|
||||
|
||||
return response
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue