Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api-headless-cms): add createdBy, ownedBy and entryId filtering (#…
- Loading branch information
1 parent
f23f9fb
commit 7e7b276
Showing
33 changed files
with
1,079 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
packages/api-headless-cms-ddb-es/__tests__/__api__/README.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,25 @@ | ||
# @webiny/api-headless-cms-ddb-es | ||
# @webiny/api-headless-cms-ddb | ||
|
||
[![](https://img.shields.io/npm/dw/@webiny/api-headless-cms-ddb-es.svg)](https://www.npmjs.com/package/@webiny/api-headless-cms-ddb-es) | ||
[![](https://img.shields.io/npm/v/@webiny/api-headless-cms-ddb-es.svg)](https://www.npmjs.com/package/@webiny/api-headless-cms-ddb-es) | ||
[![](https://img.shields.io/npm/dw/@webiny/api-headless-cms-ddb.svg)](https://www.npmjs.com/package/@webiny/api-headless-cms-ddb) | ||
[![](https://img.shields.io/npm/v/@webiny/api-headless-cms-ddb.svg)](https://www.npmjs.com/package/@webiny/api-headless-cms-ddb) | ||
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | ||
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) | ||
|
||
## Install | ||
|
||
``` | ||
npm install --save @webiny/api-headless-cms-ddb-es | ||
npm install --save @webiny/api-headless-cms-ddb | ||
``` | ||
|
||
Or if you prefer yarn: | ||
|
||
``` | ||
yarn add @webiny/api-headless-cms-ddb-es | ||
yarn add @webiny/api-headless-cms-ddb | ||
``` | ||
|
||
## Testing | ||
To run the tests only for this package you must filter it with keywords. | ||
### Command | ||
```` | ||
yarn test packages/api-headless-cms --keyword=cms:ddb --keyword=cms:base | ||
```` |
This file was deleted.
Oops, something went wrong.
75 changes: 39 additions & 36 deletions
75
packages/api-headless-cms-ddb/src/operations/entry/systemFields.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,44 @@ | ||
import { CmsContentModelField } from "@webiny/api-headless-cms/types"; | ||
|
||
const id = ({ | ||
id: "id", | ||
type: "text", | ||
fieldId: "id" | ||
} as unknown) as CmsContentModelField; | ||
const createdOn = ({ | ||
id: "createdOn", | ||
type: "datetime", | ||
fieldId: "createdOn" | ||
} as unknown) as CmsContentModelField; | ||
const savedOn = ({ | ||
id: "savedOn", | ||
type: "datetime", | ||
fieldId: "savedOn" | ||
} as unknown) as CmsContentModelField; | ||
const createdBy = ({ | ||
id: "createdBy", | ||
type: "plainObject", | ||
fieldId: "createdBy", | ||
settings: { | ||
path: "ownedBy.id" | ||
} | ||
} as unknown) as CmsContentModelField; | ||
const ownedBy = ({ | ||
id: "ownedBy", | ||
type: "plainObject", | ||
fieldId: "ownedBy", | ||
settings: { | ||
path: "ownedBy.id" | ||
} | ||
} as unknown) as CmsContentModelField; | ||
const createSystemField = (field: Partial<CmsContentModelField>): CmsContentModelField => { | ||
return field as CmsContentModelField; | ||
}; | ||
|
||
export const systemFields: Record<string, CmsContentModelField> = { | ||
id, | ||
createdOn, | ||
savedOn, | ||
createdBy, | ||
ownedBy | ||
id: createSystemField({ | ||
id: "id", | ||
type: "text", | ||
fieldId: "id" | ||
}), | ||
entryId: createSystemField({ | ||
id: "entryId", | ||
type: "text", | ||
fieldId: "entryId" | ||
}), | ||
createdOn: createSystemField({ | ||
id: "createdOn", | ||
type: "datetime", | ||
fieldId: "createdOn" | ||
}), | ||
savedOn: createSystemField({ | ||
id: "savedOn", | ||
type: "datetime", | ||
fieldId: "savedOn" | ||
}), | ||
createdBy: createSystemField({ | ||
id: "createdBy", | ||
type: "plainObject", | ||
fieldId: "createdBy", | ||
settings: { | ||
path: "createdBy.id" | ||
} | ||
}), | ||
ownedBy: createSystemField({ | ||
id: "ownedBy", | ||
type: "plainObject", | ||
fieldId: "ownedBy", | ||
settings: { | ||
path: "ownedBy.id" | ||
} | ||
}) | ||
}; |
Oops, something went wrong.