-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(webapp): [nan-839] add secondary url (#2135)
## Describe your changes Add the ability to add a secondary webhook url. I purposely treated it as a another column to reduce complexity and to set a hard limit of the number of webhooks we allow customers to send to. Two should be the max IMO. Also fixes environment name instead of the incorrect `account` ## Issue ticket number and link NAN-839 ## Checklist before requesting a review (skip if just adding/editing APIs & templates) - [ ] I added tests, otherwise the reason is: - [ ] I added observability, otherwise the reason is: - [ ] I added analytics, otherwise the reason is: --------- Co-authored-by: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
- Loading branch information
1 parent
a81679a
commit b007bc2
Showing
18 changed files
with
259 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/shared/lib/db/migrations/20240509171724_add_webhook_secondary.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
exports.up = async function (knex, _) { | ||
return knex.schema.alterTable('_nango_environments', function (table) { | ||
table.text('webhook_url_secondary'); | ||
}); | ||
}; | ||
|
||
exports.down = function (knex, _) { | ||
return knex.schema.alterTable('_nango_environments', function (table) { | ||
table.dropColumn('webhook_url_secondary'); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import useSWR from 'swr'; | ||
import type { Account } from '../types'; | ||
import type { Environment } from '../types'; | ||
import { swrFetcher } from '../utils/api'; | ||
|
||
export function useEnvironment(env: string) { | ||
const { data, error, mutate } = useSWR<{ account: Account }>(`/api/v1/environment?env=${env}`, swrFetcher, {}); | ||
const { data, error, mutate } = useSWR<{ environment: Environment }>(`/api/v1/environment?env=${env}`, swrFetcher, {}); | ||
|
||
const loading = !data && !error; | ||
|
||
return { | ||
loading, | ||
error, | ||
environment: data?.account, | ||
environment: data?.environment, | ||
mutate | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.