MishkaCmsCore.Runtime.PageBuilder.StylesheetRow (Mishka CMS Core v0.0.1)

Copy Markdown View Source

The stylesheet row the page builder owns for one site, found by its reserved name: the reusable classes (MishkaCmsCore.Runtime.PageBuilder.Classes) and an element's own CSS (MishkaCmsCore.Runtime.PageBuilder.ElementCss) are each one row of Stylesheet.

Scoped, not capped

The reserved name is the same constant on every site and the identity is [:name, :site_id], so the name alone matches one row per site. Asking for one row before saying which site it is for hands back whichever rows the read reached, and the site's own row then reads as absent.

A master's read (:master_read) bypasses multitenancy, so every site's row is a candidate and the site has to be in the query. A tenant's read is already scoped by Ash; the globals are the scope whose site_id is nil (site_id == ^nil is a comparison that can never match), so the filter is written once for both.

Summary

Functions

The row called name on site_id (nil for the globals), read as actor, or nil when there is none or it cannot be read.

Functions

fetch(actor, site_id, name)

@spec fetch(map() | nil, String.t() | nil, String.t()) ::
  MishkaCmsCore.Runtime.Stylesheet.t() | nil

The row called name on site_id (nil for the globals), read as actor, or nil when there is none or it cannot be read.