Evidence Submission
This document describes the Evidence Submission feature, allowing Taskers to submit proof of work for their tasks.
1. Overview
Once a Tasker accepts a Referee’s request (or is matched), the Task enters a state where evidence can be submitted. The evidence consists of a text description and up to 5 image assets.
The submission process uses Cloudflare R2 for image storage and Supabase for metadata and status management.
2. Upload Sequence
The following sequence diagram illustrates the secure upload flow, including:
-
Fetching Task details (to verify permissions).
-
Generating a presigned URL via Edge Function (which securely holds R2 credentials and public domain logic).
-
Direct upload to R2 (bypassing the application server for heavy lifting).
-
Submitting metadata (including R2 keys and public URLs) to the database via a secure RPC.
3. Key Components
3.1. Edge Function: generate-upload-url
-
Responsibility:
-
Validates user authentication and Task ownership.
-
Generates a unique R2 Object Key (
evidence/…). -
Generates a recursive 10-minute Presigned PUT URL.
-
Constructs the
public_urlusing theR2_PUBLIC_DOMAINenvironment variable.
-
-
Security: Ensures only the Tasker can upload files for their specific task.
3.2. RPC: submit_evidence
-
Responsibility:
-
Validates that the Judgement status is
awaiting_evidenceorin_review. -
Atomically transitions the Judgement status to
in_review. -
Inserts records into
task_evidencesandtask_evidence_assets.
-
-
Concurrency: Uses database transactions to ensure data consistency.