Skip to content

media Table

Overview

Item Details
Table name media
Description Metadata for uploaded media files (images, videos) and AI-generated thumbnail images. The files themselves live in S3; this table holds their URLs
Primary use Uploading and listing media, referencing thumbnails

Column Definitions

Column Type PK FK Unique Nullable Default Notes
_id ObjectId โ—ฏ โ—ฏ Auto-generated by DocumentDB
name string โ—ฏ Unique index. Also used as the S3 object key
mime_type enum image / video
s3_url string URL of the stored object. Thumbnails store the CloudFront URL
size int Bytes
race_id string auto_racing:_id / bicycle_racing:_id / horse_racing:_id โ—ฏ Set only for race-derived media such as thumbnails; null for general uploads
created_at number
updated_at number Lists are sorted by update date/time by default
deleted_at number โ—ฏ

Thumbnail naming

Thumbnails produced by the thumbnail_generation Lambda are upserted on the unique name, so regenerating one (e.g. after an SQS redelivery) does not create duplicates.

Target name S3 key
Article thumbnail_{race_id}.jpg {racing_type}/thumbnail/{race_id}.jpg
Blog thumbnail_blog_{blog_id}.jpg {racing_type}/thumbnail/blog_{blog_id}.jpg

How s3_url is served

Path URL returned
Media API (GET /v1/medias, โ€ฆ) A freshly generated S3 presigned URL valid for one hour
Thumbnails (embedded in blog bodies) A public CloudFront URL (the S3 bucket itself is private)