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