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

Retrieve submission photo using its submission id in submission detail page #1794

Merged
merged 4 commits into from
Sep 21, 2024

Conversation

Sujanadh
Copy link
Collaborator

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation
  • πŸ§‘β€πŸ’» Refactor
  • βœ… Test
  • πŸ€– Build or CI
  • ❓ Other (please specify)

Related Issue

Describe this PR

This PR creates a new endpoint that retrieves the submission photos using the submission_id (instance_id) of the particular submission. This endpoint can be used in submission detail page to visualize the submission images for example user uploaded images in verification section (digitisation_form).

  • endpoint example : https://api.dev.fmtm.hotosm.org/submission/get-submission-photo?submission_id=uuid%3A55cd4d36-8cbc-47e0-b48d-d0846e268c21

Response

{
  "s3_path": "http://s3.fmtm.localhost:7050/fmtm-data/1/24/uuid:55cd4d36-8cbc-47e0-b48d-d0846e268c21/1.jpeg"
}

Alternative Approaches Considered

Did you attempt any other approaches that are not documented in code?

Review Guide

Notes for the reviewer. How to test this change?

Checklist before requesting a review

[optional] What gif best describes this PR or how it makes you feel?

@Sujanadh Sujanadh self-assigned this Sep 18, 2024
@github-actions github-actions bot added enhancement New feature or request backend Related to backend code labels Sep 18, 2024
@Sujanadh
Copy link
Collaborator Author

Updates:

  • changed return response to list in case of multiple images in single submission in near future
  • changed s3_path key to image_url

Updated Response:

{
  "image_url": [
    "http://s3.fmtm.localhost:7050/fmtm-data/1/24/uuid:55cd4d36-8cbc-47e0-b48d-d0846e268c21/1.jpeg"
  ]
}

@spwoodcock
Copy link
Member

I made a small refactor to use path params instead, so submission detail should: /submission/{submission_id} and the photos list should be /submission/{submission_id}/photos.

I didn't get a chance to test, but as this doesn't break anything I'm going to merge and we can test it later πŸ‘

@spwoodcock spwoodcock merged commit bd1276b into development Sep 21, 2024
9 checks passed
@spwoodcock spwoodcock deleted the feat/submission-photo-api branch September 21, 2024 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend code enhancement New feature or request frontend Related to frontend code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants