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

api: Added /webhook/subscribed/:event api #994

Merged
merged 6 commits into from
May 1, 2022

Conversation

gioelecerati
Copy link
Member

What does this pull request do? Explain your changes. (required)

Added /webhook/subscribed/:event api to retrieve all the webhooks subscribed to a particular event.
Admins can also provide a user id in the query to retrieve webhooks subscribed to an event of a particular user.
Needed by mapic to retrieve user.new subscriptions

Specific updates (required)

How did you test each of these updates (required)

Does this pull request close any open issues?

Screenshots (optional):

Checklist:

  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@gioelecerati gioelecerati requested a review from a team as a code owner April 7, 2022 17:56
@vercel
Copy link

vercel bot commented Apr 7, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/livepeer/livepeer-com/8DifNqauWx8nW8SuF2E8gzk3zPL6
✅ Preview: https://livepeer-com-git-gio-apisubscribedwebhooks-livepeer.vercel.app

let userId = req.user.id;

if (req.user.admin && req.query.userId) {
userId = req.query.userId;
Copy link
Member

Choose a reason for hiding this comment

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

can use a ternary operator:

let userId = (req.user.admin && req.query.userId) ? req.query.userId : req.user.id;

Copy link
Member

@victorges victorges Apr 11, 2022

Choose a reason for hiding this comment

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

Or even perhaps

let userId = (req.user.admin && req.query.userId) || req.user.id;

@vercel
Copy link

vercel bot commented May 1, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
livepeer-com ✅ Ready (Inspect) Visit Preview May 1, 2022 at 0:57AM (UTC)

@iameli iameli merged commit de9808b into master May 1, 2022
@iameli iameli deleted the gio/api/subscribed_webhooks branch May 1, 2022 12:47
@iameli iameli restored the gio/api/subscribed_webhooks branch May 1, 2022 12:48
@iameli iameli deleted the gio/api/subscribed_webhooks branch May 1, 2022 12:48
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.

None yet

4 participants