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) |