Skip to main content

11 — Assets

What it is: Centralized image (and eventually video/PDF) storage. Assets are uploaded to S3/CloudFront by the admin project; this backend just stores the URL and maps it to entities.


Tables

tbl_assets

One row per uploaded file.

FieldNotes
assetIdPK — a text column holding a UUID-formatted string generated by the admin project on upload (not a Postgres uuid type; cast/compare as text)
urlCloudFront URL
aspectRatioe.g. "16:9", "1:1" — for responsive layouts
width / heightpixels, optional
name / descriptionadmin UI labels

tbl_asset_entity_mapping

Links an asset to an entity. One asset can map to many entities; one entity can have many assets.

FieldNotes
assetIdFK to tbl_assets
entityCodeentity type — stored lowercase: event, suite, suite_type, map, program, addon, notification
entityIdthe entity's identifier (string IDs used directly; integer IDs cast to VARCHAR)
entitySubcodeasset purpose within that entity (see below)
deviceTypeDESKTOP, MOBILE, TABLET
displayOrdersort order for carousels (lower = first)
backgroundColorhex, optional — for text overlay readability

Entity code + subcode combinations

All values below are the actual stored strings (lowercase).

entityCodesubcodesUsed for
eventlogo, background, carouselopponent logo, event background, image carousel
suite / suite_typehero, gallery, menusuite hero image, photo gallery, food/drink menu
mapstaticstatic venue map image (iomedia or static source only — 3DDV doesn't use assets)
programbannerprogram banner (sign-up / home page)
addonaddon_logo, addon_imageadd-on logo and image
notificationbuyer_email_bannerbanner in the buyer confirmation email

Entity ID format

  • String-based IDs (e.g. eventCode): used directly
  • Integer IDs (e.g. suiteId, mapId, programId): cast to VARCHAR — CAST(id AS VARCHAR)

Key rules

  • All assets are public CloudFront URLs — no auth required to access them
  • Admin project handles upload to S3 and UUID generation; this backend only stores the result
  • Named "asset" not "image" so it can grow to video/PDF in future (not supported yet)
  • ON DELETE RESTRICT on the FK — can't hard-delete an asset while active mappings exist; use soft delete
  • Device type is always required on mappings; frontend picks the right one for the client