# new BaseRecord(params, resource)
Parameters:
Name | Type | Description |
---|---|---|
params |
ParamsType
|
all resource data. I.e. field values |
resource |
BaseResource
|
resource to which given record belongs |
Classes
Members
# errors
# params
with BaseRecord#get and BaseRecord#set property.
ParamsType
# params
with BaseRecord#get and BaseRecord#set property.
# populated
# resource
Methods
# async create() → {Promise.<BaseRecord>}
Practically it invokes BaseResource#create.
When validation error occurs it stores that to BaseResource#errors
given record (this)
Promise.<BaseRecord>
# error(path) → {RecordError|null}
Parameters:
Name | Type | Description |
---|---|---|
path |
string
|
(name) of property which we want to check if is valid |
validation message of null
RecordError
|
null
# get(propertyPathopt, optionsopt) → {any}
structure:
params = {
genre.0: 'male',
genre.1: 'female',
}
for get('genre')
function will return ['male', 'female']
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
propertyPath |
string
|
<optional> |
path for the property. If not set function returns an entire unflatten object |
options |
GetOptions
|
<optional> |
unflatten data under given path
any
# isValid() → {boolean}
if record is valid or not.
boolean
# namespaceParams(prefix) → {object|undefined}
Parameters:
Name | Type | Description |
---|---|---|
prefix |
string
|
- Deprecated:
- in favour of selectParams
View Source adminjs/src/backend/adapters/record/base-record.ts, line 369
object
|
undefined
# param(path) → {any}
Parameters:
Name | Type | Description |
---|---|---|
path |
string
|
path (name) for given field: i.e. 'email' or 'authentication.email' if email is nested within the authentication object in the data store |
- Deprecated:
- in favour of BaseRecord#get and BaseRecord#set methods
View Source adminjs/src/backend/adapters/record/base-record.ts, line 328
value for given field
any
# populate(propertyPath, recordopt) → {void}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
propertyPath |
string
|
name of the property which should be populated |
|
record |
BaseRecord
|
null
|
<optional> |
record to which property relates. If record is null or undefined - function clears the previous value |
void
# async save() → {Promise.<BaseRecord>}
it creates new one.
Practically it invokes BaseResource#create or BaseResource#update methods.
When validation error occurs it stores that to BaseResource#errors
given record (this)
Promise.<BaseRecord>
# selectParams(prefix, optionsopt) → {object|undefined}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
prefix |
string
|
||
options |
GetOptions
|
<optional> |
object
|
undefined
# set(propertyPath, value)
path are replaced. When value is undefined
function just clears the old values
Parameters:
Name | Type | Description |
---|---|---|
propertyPath |
string
|
|
value |
any
|
an entire, updated, params object
# storeParams(payloadDataopt) → {void}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
payloadData |
object
|
<optional> |
void
# title() → {string}
title etc.
Title will be shown in the breadcrumbs for example.
title of the record
string
# toJSON(currentAdminopt) → {RecordJSON}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
currentAdmin |
CurrentAdmin
|
<optional> |
# async update(params) → {Promise.<BaseRecord>}
BaseResource.update method.
When validation error occurs it stores that to BaseResource.errors
Parameters:
Name | Type | Description |
---|---|---|
params |
object
|
all field with values which has to be updated |
given record (this)
Promise.<BaseRecord>