-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Implement endpoint duplication check in CheckConfirmationContro… #1215
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
Merged
gibahjoe
merged 9 commits into
main
from
1198-dont-allow-duplicate-endpoint-to-be-submitted
Jul 1, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
330eb07
feat: Implement endpoint duplication check in CheckConfirmationContro…
gibahjoe d4873b0
fix: Enhance endpoint duplication check to include organisation param…
gibahjoe e7cad14
test: Add checks for organisation in endpoint duplication logic and u…
gibahjoe 9fac5cf
fix: Update heading levels for clarity in confirmation view
gibahjoe 77faa7c
fix: issue with column mapping showing inconsistently
gibahjoe 7236e02
test: Add checks for empty dataset in endpointAlreadyCollected functi…
gibahjoe d23362b
fix: Update confirmation message for clarity on endpoint submission
gibahjoe 75e65a9
fix: Improve confirmation message clarity and heading structure in co…
gibahjoe 548b7de
fix: Remove REPLACE function from organisation query to match directly
gibahjoe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,26 @@ | ||
| import datasette from '../../services/datasette.js' | ||
|
|
||
| function sqlString (value) { | ||
| return String(value).replaceAll("'", "''") | ||
| } | ||
|
|
||
| export async function endpointAlreadyCollectedForDataset ({ endpointUrl, dataset, organisation }) { | ||
| if (!endpointUrl || !dataset || !organisation) return false | ||
|
|
||
| const sql = /* sql */ ` | ||
| SELECT 1 | ||
| FROM endpoint e | ||
| JOIN resource_endpoint re ON e.endpoint = re.endpoint | ||
| JOIN resource r ON re.resource = r.resource | ||
| JOIN resource_dataset rd ON r.resource = rd.resource | ||
| JOIN resource_organisation ro ON r.resource = ro.resource | ||
| WHERE e.endpoint_url = '${sqlString(endpointUrl)}' | ||
| AND rd.dataset = '${sqlString(dataset)}' | ||
| AND ro.organisation = '${sqlString(organisation)}' | ||
| AND (e.end_date IS NULL OR e.end_date = '') | ||
| AND (r.end_date IS NULL OR r.end_date = '') | ||
| LIMIT 1` | ||
|
|
||
| const response = await datasette.runQuery(sql) | ||
| return response.formattedData.length > 0 | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.