-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FORMS-1563: auto-approve new ext api when same ministry/url already a… (
#1543) * FORMS-1563: auto-approve new ext api when same ministry/url already approved. Signed-off-by: Jason Sherman <[email protected]> * limit usage of raw sql Signed-off-by: Jason Sherman <[email protected]> * add a sql injection block Signed-off-by: Jason Sherman <[email protected]> * Show sendApiKey fo admins before approving an api Signed-off-by: Jason Sherman <[email protected]> --------- Signed-off-by: Jason Sherman <[email protected]>
- Loading branch information
1 parent
a0285a6
commit 51fa134
Showing
7 changed files
with
184 additions
and
23 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
27 changes: 27 additions & 0 deletions
27
app/src/db/migrations/20241218233455_062_update_external_api_vw.js
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,27 @@ | ||
exports.up = function (knex) { | ||
return Promise.resolve() | ||
.then(() => knex.schema.dropViewIfExists('external_api_vw')) | ||
.then(() => | ||
knex.schema.raw(`create or replace view external_api_vw as | ||
select e.id, e."formId", f.ministry, f.name as "formName", e.name, e."endpointUrl", | ||
e.code, easc.display, e."allowSendUserToken", e."sendApiKey" from external_api e | ||
inner join external_api_status_code easc on e.code = easc.code | ||
inner join form f on e."formId" = f.id | ||
order by f.ministry, "formName", e.name;`) | ||
); | ||
}; | ||
|
||
exports.down = function (knex) { | ||
return Promise.resolve() | ||
.then(() => knex.schema.dropViewIfExists('external_api_vw')) | ||
.then(() => | ||
knex.schema.raw( | ||
`create or replace view external_api_vw as | ||
select e.id, e."formId", f.ministry, f.name as "formName", e.name, e."endpointUrl", | ||
e.code, easc.display, e."allowSendUserToken" from external_api e | ||
inner join external_api_status_code easc on e.code = easc.code | ||
inner join form f on e."formId" = f.id | ||
order by f.ministry, "formName", e.name;` | ||
) | ||
); | ||
}; |
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
Oops, something went wrong.