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: QR Generation & Storage: Supabase Edge Function #10

Merged
merged 17 commits into from
Dec 11, 2024

Conversation

AlexWang05
Copy link
Member

What's new in this PR

Description

Implement a Supabase Edge Function using Deno that generates a QR code image based on a tree_id input, and stores the image in our Supabase storage bucket.

How to review

For more context, read the documentation at src/supabase/functions/README.md. Then, review index.ts.
Testing details are found in the README, but local testing generally involves more setup (Docker desktop, Supabase CLI). If you are looking to test, I'd recommend testing the deployed Edge function:

The deployed Edge Function should be visible via the Supabase console. You can test the deployed function with the following curl command. Be sure to replace ANON_KEY with the actual key, and the tree_id with a ID that doesn't already have an image created in the Supabase bucket. After the request, you can verify that the QR image is added to our Supabase Storage bucket, and that it contains the correct tree_id.

curl --request POST 'https://uwgmvckenedkuhmwkqvi.supabase.co/functions/v1/qr-generate' \
  --header 'Authorization: Bearer ANON_KEY' \
  --header 'Content-Type: application/json' \
  --data '{ "tree_id":"123456789" }'

Next steps

Consider client-side usage, and design a way to handle errors (multiple requests for the same id, etc), which involves finding where this Edge function is to be called, and other implementation details.

Relevant links

Online sources

Developing Edge Functions Locally
Deploy to Production
ocf-18

CC: @christophertorres1

@christophertorres1 christophertorres1 merged commit 9d73ed5 into main Dec 11, 2024
2 checks passed
@christophertorres1 christophertorres1 changed the title QR Generation & Storage: Supabase Edge Function [OCF-18] feat: QR Generation & Storage: Supabase Edge Function Dec 11, 2024
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.

3 participants