Skip to content

BeechCMS


BeechCMS / @beechcms/core / IContentViewRepository

Interface: IContentViewRepository ​

Persistence for shared, ordered view instances (seed_views). Every write is one statement or one D1 batch, so each method is atomic. Implementations own id minting and timestamps (IIdGenerator / IClock injected).

Methods ​

create() ​

create(input, updatedBy): Promise<ContentViewRecord>

Appends after the current last position.

Parameters ​

input ​

NewContentView

updatedBy ​

string

Returns ​

Promise<ContentViewRecord>


ensureDefaults() ​

ensureDefaults(seedSlug, types, updatedBy): Promise<void>

Inserts one untitled instance per type, at positions 0..n-1. Each insert is skipped when the seed already has an instance of that type, so concurrent first reads never duplicate.

Parameters ​

seedSlug ​

string

types ​

readonly DashboardView[]

updatedBy ​

string

Returns ​

Promise<void>


get() ​

get(seedSlug, id): Promise<ContentViewRecord | null>

Parameters ​

seedSlug ​

string

id ​

string

Returns ​

Promise<ContentViewRecord | null>


listBySeed() ​

listBySeed(seedSlug): Promise<ContentViewRecord[]>

All rows of a seed, including types the allow-list currently hides, ordered by position.

Parameters ​

seedSlug ​

string

Returns ​

Promise<ContentViewRecord[]>


remove() ​

remove(seedSlug, id): Promise<RemoveContentViewResult>

Refuses ('last-table') to delete the seed's only Table instance, atomically.

Parameters ​

seedSlug ​

string

id ​

string

Returns ​

Promise<RemoveContentViewResult>


reorder() ​

reorder(seedSlug, orderedIds, updatedBy): Promise<void>

Writes position = index for each id. Ids not listed keep their position.

Parameters ​

seedSlug ​

string

orderedIds ​

readonly string[]

updatedBy ​

string

Returns ​

Promise<void>


update() ​

update(seedSlug, id, patch, updatedBy): Promise<ContentViewRecord | null>

Parameters ​

seedSlug ​

string

id ​

string

patch ​

ContentViewPatch

updatedBy ​

string

Returns ​

Promise<ContentViewRecord | null>