4.6 KiB
id, title, sidebar_label, sidebar_position, custom_edit_url
| id | title | sidebar_label | sidebar_position | custom_edit_url |
|---|---|---|---|---|
| entityschema | Interface: EntitySchema<Key, T> | EntitySchema | 0 | null |
Specification for defining an entity
Type parameters
| Name | Type |
|---|---|
Key |
Key: string = string |
T |
T: any = any |
Properties
customId
• Optional customId: boolean | EnumValues
If this property is not set Firestore will create a random ID. You can set the value to true to allow the users to choose the ID. You can also pass a set of values (as an EnumValues object) to allow them to pick from only those
Defined in
defaultValues
• Optional defaultValues: Partial<EntityValues<EntitySchema<Key, T>, Key>>
When creating a new entity, set some values as already initialized
Defined in
description
• Optional description: string
Description of this entity
Defined in
name
• name: string
Singular name of the entity as displayed in an Add button . E.g. Product
Defined in
properties
• properties: PropertiesOrBuilder<EntitySchema<Key, T>, Key, T>
Set of properties that compose an entity
Defined in
Methods
onDelete
▸ Optional onDelete(entityDeleteProps): void
Hook called after the entity is deleted in Firestore.
Parameters
| Name | Type |
|---|---|
entityDeleteProps |
EntityDeleteProps<EntitySchema<Key, T>, Key> |
Returns
void
Defined in
onPreDelete
▸ Optional onPreDelete(entityDeleteProps): void
Hook called after the entity is deleted in Firestore. If you throw an error in this method the process stops, and an error snackbar gets displayed.
Parameters
| Name | Type |
|---|---|
entityDeleteProps |
EntityDeleteProps<EntitySchema<Key, T>, Key> |
Returns
void
Defined in
onPreSave
▸ Optional onPreSave(entitySaveProps): EntityValues<EntitySchema<Key, T>, Key> | Promise<EntityValues<EntitySchema<Key, T>, Key>>
Hook called before saving, you need to return the values that will get saved. If you throw an error in this method the process stops, and an error snackbar gets displayed.
Parameters
| Name | Type |
|---|---|
entitySaveProps |
EntitySaveProps<EntitySchema<Key, T>, Key> |
Returns
EntityValues<EntitySchema<Key, T>, Key> | Promise<EntityValues<EntitySchema<Key, T>, Key>>
Defined in
onSaveFailure
▸ Optional onSaveFailure(entitySaveProps): void | Promise<void>
Hook called when saving fails
Parameters
| Name | Type |
|---|---|
entitySaveProps |
EntitySaveProps<EntitySchema<Key, T>, Key> |
Returns
void | Promise<void>
Defined in
onSaveSuccess
▸ Optional onSaveSuccess(entitySaveProps): void | Promise<void>
Hook called when save is successful
Parameters
| Name | Type |
|---|---|
entitySaveProps |
EntitySaveProps<EntitySchema<Key, T>, Key> |
Returns
void | Promise<void>