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

feat(api): add external API endpoint for updating urls #2079

Merged
merged 11 commits into from
Nov 15, 2022

Conversation

halfwhole
Copy link
Collaborator

@halfwhole halfwhole commented Nov 14, 2022

Problem

We want to add an external API endpoint for updating URLs (PATCH /api/v1/urls)

Solution

Added the updateUrl method to ApiV1Controller for updating URLs

Note that the request format is different for the internal vs. external APIs:

  • Internal API: PATCH /api/v1/url, body must contain shortUrl
  • External API: PATCH /api/v1/urls/:shortUrl

Possible future improvements:

  • (For both internal and external APIs) Long URL Joi validation should also check for validity and circular redirects! Currently it only checks for HTTPS and blacklists, so invalid URLs + circular redirects only fails with Sequelize at the repo layer

Tests

  • Unit tests for updating URLs

Should add integration tests, when we have them

@halfwhole halfwhole marked this pull request as ready for review November 15, 2022 03:09
Base automatically changed from feat/api/create-url to develop November 15, 2022 03:13
@gitguardian

This comment was marked as outdated.

@halfwhole halfwhole merged commit 7ab8fce into develop Nov 15, 2022
@halfwhole halfwhole deleted the feat/api/update-url branch November 15, 2022 04:03
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.

2 participants