mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 10:23:34 +00:00
feat: allow default sorting by creator fields
This commit is contained in:
parent
3f5fd5aa9b
commit
54d12894a7
@ -8,7 +8,8 @@ const {
|
||||
hasEditableAttribute,
|
||||
} = require('../../services/utils/configuration/attributes');
|
||||
|
||||
const { getNonVisibleAttributes, getWritableAttributes } = contentTypes;
|
||||
const { getNonVisibleAttributes, getWritableAttributes, constants } = contentTypes;
|
||||
const { CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = constants;
|
||||
|
||||
/**
|
||||
* Creates the validation schema for content-type configurations
|
||||
@ -46,7 +47,14 @@ const createSettingsSchema = (schema) => {
|
||||
// should be reset when the type changes
|
||||
defaultSortBy: yup
|
||||
.string()
|
||||
.oneOf(validAttributes.concat(['id', ...nonVisibleWritableAttributes]))
|
||||
.oneOf(
|
||||
validAttributes.concat([
|
||||
'id',
|
||||
...nonVisibleWritableAttributes,
|
||||
CREATED_BY_ATTRIBUTE,
|
||||
UPDATED_BY_ATTRIBUTE,
|
||||
])
|
||||
)
|
||||
.default('id'),
|
||||
defaultSortOrder: yup.string().oneOf(['ASC', 'DESC']).default('ASC'),
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user