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.
| Naming | Value |
|---|
| Object | CompanyMedia |
Resource type (JSON:API type) | company_media |
| Collection / records root | β (not a records root) |
| REST base | /v1/company-media |
| Entity class | CompanyMedia |
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.
API operations
| Operation | Method & path | Status |
|---|
| List | GET /v1/company-media | π‘ Planned |
| Retrieve | GET /v1/company-media/{id} | π‘ Planned |
| Create | POST /v1/company-media | π‘ Planned |
| Update | PATCH /v1/company-media/{id} | π‘ Planned |
| Delete | DELETE /v1/company-media/{id} | π‘ Planned |
Data model
Attributes
| Field | Type | Required | Constraints | Allowed values | Description |
|---|
| created_at | datetime π system | β
Yes | Auto-set via onCreate hook; not nullable | β | Timestamp when the companyβmedia association was created. Set automatically on insert; never updated. |
| deleted_at | datetime | null | βͺ No | Nullable. 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
| Name | Type | Required | Description |
|---|
| company | to-one (ManyToOne) | β
Yes | The 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. |
| media | to-one (ManyToOne) | β
Yes | The 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