ResourceModel
ResourceModel =
object
Defined in: packages/schema/src/model.ts:86
A resource as the server and the app see it: a table, its fields and what the API does with them, built by
resource(...).toModel(); see resource().
Properties
Section titled “Properties”comments?
Section titled “comments?”
optionalcomments?:true
Defined in: packages/schema/src/model.ts:122
Whether people who may read its records comment on them (.comments()).
events?
Section titled “events?”
optionalevents?:EventModel[]
Defined in: packages/schema/src/model.ts:118
The events its changes raise (.events()), the catalogue subscriptions pick from.
fields
Section titled “fields”fields:
Record<string,FieldModel>
Defined in: packages/schema/src/model.ts:97
Its fields, by field name.
history?
Section titled “history?”
optionalhistory?:true
Defined in: packages/schema/src/model.ts:120
Whether every change of its records is kept, with who made it (.history()).
name:
string
Defined in: packages/schema/src/model.ts:88
The resource’s name: its address (/api/v1/<name>, /<name> in the admin) and how other config refers to it.
owner?
Section titled “owner?”
optionalowner?:string
Defined in: packages/schema/src/model.ts:109
The field holding the owning user’s id; .own capability scopes filter on it.
position?
Section titled “position?”
optionalposition?:object
Defined in: packages/schema/src/model.ts:111
The integer field holding the records’ order by hand (.position()), 1 the first.
field:
string
The integer field, 1 the first record.
within?
Section titled “within?”
optionalwithin?:string
The relation whose records each have an order of their own, as an invoice’s items do; one order for all records when omitted.
primaryKey
Section titled “primaryKey”primaryKey:
string[]
Defined in: packages/schema/src/model.ts:99
The fields of its key, in order; records are addressed by it.
search?
Section titled “search?”
optionalsearch?:string[]
Defined in: packages/schema/src/model.ts:105
Field names that the bare-text search filter matches against.
searchMatch?
Section titled “searchMatch?”
optionalsearchMatch?:Record<string,SearchMatch>
Defined in: packages/schema/src/model.ts:107
How a search field matches when not by containing the word; see SearchMatch.
softDelete?
Section titled “softDelete?”
optionalsoftDelete?:string
Defined in: packages/schema/src/model.ts:101
The field a delete sets instead of removing the row, and lists leave such rows out (.softDelete()).
table:
object
Defined in: packages/schema/src/model.ts:90
The table it reads and writes.
name:
string
The table’s name.
schema?
Section titled “schema?”
optionalschema?:string
The table’s schema; the search path decides when omitted.
tenant?
Section titled “tenant?”
optionaltenant?:string
Defined in: packages/schema/src/model.ts:103
The field that separates tenants: every query is limited to the caller’s tenant (.tenant()).