Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.wellapp.ai/llms.txt

Use this file to discover all available pages before exploring further.

CompanyMedia is a soft-deleteable pivot (bridge) entity that links a Company to a Media asset. It records when a media file (logo, avatar, or banner) was associated with a company and is the persistence mechanism for the β€œadd/remove company media” mutations. The entity carries no scalar attributes of its own beyond timestamps; all descriptive content lives on the related Media row. Two compound indexes optimise the Hasura array-relationship traversals in both directions: (company_pk, deleted_at) for the forward pass and (media_pk) for the reverse pass.
NamingValue
ObjectCompanyMedia
Resource type (JSON:API type)company_media
Collection / records rootβ€” (not a records root)
REST base/v1/company-media
Entity classCompanyMedia
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.

API operations

OperationMethod & pathStatus
ListGET /v1/company-media🟑 Planned
RetrieveGET /v1/company-media/{id}🟑 Planned
CreatePOST /v1/company-media🟑 Planned
UpdatePATCH /v1/company-media/{id}🟑 Planned
DeleteDELETE /v1/company-media/{id}🟑 Planned

Data model

Attributes

FieldTypeRequiredConstraintsAllowed valuesDescription
created_atdatetime πŸ”’ systemβœ… YesAuto-set via onCreate hook; not nullableβ€”Timestamp when the company–media association was created. Set automatically on insert; never updated.
deleted_atdatetime | nullβšͺ NoNullable. Non-null value soft-deletes the row; all queries must filter deleted_at IS NULL.β€”Soft-delete sentinel. Set to the deletion timestamp when the media is unlinked from the company; null when the association is active.

Relationships

NameTypeRequiredDescription
companyto-one (ManyToOne)βœ… YesThe Company to which this media asset is attached. Indexed as part of the composite (company_pk, deleted_at) index for Hasura array-relationship traversals. Target entity: Company.
mediato-one (ManyToOne)βœ… YesThe Media asset (logo, avatar, or banner) being linked to the company. Indexed on (media_pk) for the reverse array-relationship traversal. Target entity: Media.

System-computed

  • created_at β€” set via MikroORM onCreate hook (new Date()); not writable by callers
  • deleted_at β€” written by soft-delete mutations (useAddCompanyMedia / useDeleteCompanyMedia service layer); never set by the user directly via PATCH
  • pk β€” internal auto-increment integer primary key; never exposed in the public API. No public UUID (*_id) column exists on this entity β€” the entity is identified in the API by its relationship context (company_id + media_id pair), not by a standalone resource id
  • Indexes maintained by migrations: idx_company_media_company_deleted (company_pk, deleted_at) β€” hot-path for Hasura forward traversal; idx_company_media_media (media_pk) β€” hot-path for Hasura reverse traversal. Both created in Migration20260416000000_hasura_and_service_hot_path_indexes_round4.

Example

{
  "data": {
    "type": "company_media",
    "id": "a3f1c2e4-8b7d-4a9f-bc12-0d5e6f7a8b9c",
    "attributes": {
      "created_at": "2025-11-14T09:32:00.000Z",
      "deleted_at": null
    },
    "relationships": {
      "company": {
        "data": { "type": "company", "id": "e1d2f3a4-5b6c-7d8e-9f0a-1b2c3d4e5f60" }
      },
      "media": {
        "data": { "type": "media", "id": "f9e8d7c6-b5a4-3c2d-1e0f-9a8b7c6d5e4f" }
      }
    }
  }
}
Source: apps/api/src/database/entities/CompanyMedia.ts Β· domain: financial-graph Β· tier: Supporting