Skip to content

feat: add edit URL by short code (PUT /short/:short)#1

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/add-edit-url-functionality
Draft

feat: add edit URL by short code (PUT /short/:short)#1
Copilot wants to merge 2 commits intomasterfrom
copilot/add-edit-url-functionality

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 23, 2026

Adds a missing CRUD endpoint to update the destination URL of an existing short link by its code.

Changes

  • New use case (editShort/EditShortUseCase.ts) — validates the incoming URL, looks up the short code, mutates url, and persists via the existing ShortRepository.save()
  • New controller (editShort/EditShortController.ts) — reads short from path params and url from body; returns 200, 400, or 404 appropriately
  • DI wiring (editShort/index.ts) — follows the same singleton injection pattern as createShort/findShort
  • Route (routes/index.ts) — registers PUT /short/:short before the wildcard GET /:short
  • Type fix (FindShortController.ts) — corrected pre-existing string | string[] type error on request.params.short (same cast required in the new controller)

API

PUT /short/:short
Content-Type: application/json

{ "url": "https://new-destination.com" }
Status Body Condition
200 { "short": "2796e032" } Updated
400 { "error": "Invalid URL" } Missing or malformed URL
404 { "error": "Short not found" } Code does not exist

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI changed the title [WIP] Add functionality to edit the URL by code feat: add edit URL by short code (PUT /short/:short) Mar 23, 2026
Copilot AI requested a review from awkkih March 23, 2026 22:39
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