The shape of the model type
The method keys already defined
Configures authorization rules for public, signed-in user, per user, and per user group data access
A function that receives an allow modifier to define authorization rules
A ModelType instance with updated authorization rules
a.model().authorization((allow) => [
allow.guest(),
allow.publicApiKey(),
allow.authenticated(),
])
Disables the specified operations for the model
A list of operations to be disabled
A ModelType instance with updated disabled operations
a.model().disableOperations(['delete', 'update', 'queries', 'subscriptions'])
Defines single-field or composite identifiers, the fields must be marked required
A list of field names used as identifiers for the data model
A ModelType instance with updated identifiers
a.model({
name: a.string().required(),
email: a.string().required(),
age: a.integer(),
}).identifier(['name', 'email'])
Adds secondary index for a model, secondary index consists of a "hash key" and optionally, a "sort key"
A function that specifies "hash key" and "sort key"
A ModelType instance with updated secondary index
a.model().secondaryIndexes((index) => [index('type').sortKeys(['sort'])])
Model type definition interface