Skip to content

Update Artwork Routes to Use Real Cloudinary Storage #38

@laurenwu22

Description

@laurenwu22

Description

Currently, the artwork GET and POST routes use mock URLs for image storage. This task updates the routes to integrate Cloudinary for storing and serving actual images and videos uploaded by authenticated users and guests.

Acceptance Criteria

  1. POST Route (/api/artworks)

    • Replace the mock upload function with cloudinary.uploader.upload.
    • Store files under structured folders: prod/artists/{user_id or 'guest'}.
    • Support both images and videos using resource_type: 'auto'.
    • Generate thumbnail URLs using Cloudinary transformations (e.g., width 400px, crop fill).
    • Return image_url and thumbnail_url in the response.
  2. GET Route (/api/artworks)

    • No change needed to DB query logic.
    • Ensure image_url and thumbnail_url now point to real Cloudinary-hosted assets.
  3. Validation

    • Maintain existing validations: file type, file size (max 10MB), title, description, tools_used, and guest info.
    • Handle Cloudinary upload errors, returning appropriate HTTP error codes.
  4. Testing

    • Upload an image as a logged-in user and as a guest.
    • Confirm images appear in Cloudinary Media Library under the correct folder.
    • Confirm thumbnails are generated correctly.
    • Confirm DB stores the correct URLs.
    • Confirm GET route serves the real images correctly in the public gallery.

Notes

  • Maintain all existing validation logic from the current mock implementation.
  • Keep DB schema unchanged; only update URLs stored for each artwork.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions