Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #202 from Shinsina/add-import-entity-support
Browse files Browse the repository at this point in the history
Add `customAttributes` input to `allPublishedContent`
  • Loading branch information
zarathustra323 authored Nov 30, 2021
2 parents 980032d + 287680f commit e11f283
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ input AllPublishedContentQueryInput {
sectionId: Int
"Deprecated. Use includeContentTypes instead."
contentTypes: [ContentType!] = []
"Limit results to items matching specific custom attribute key value pairs"
customAttributes: [ContentCustomAttributeQueryInput!] = []
"Limit results to items matching at least one of these types."
includeContentTypes: [ContentType!] = []
"Limit results to items matching none of these types."
Expand Down Expand Up @@ -566,6 +568,13 @@ input ContentCustomAttributeInput {
path: String!
}
input ContentCustomAttributeQueryInput {
"The object property key to query against"
key: String!
"The value of that property key to query against"
value: String!
}
input AllContentQueryInput {
siteId: ObjectID
status: ModelStatus = active
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ module.exports = {
beginning,
ending,
withSite,
customAttributes,
} = input;

// @deprecated Prefer includeContentTypes over contentTypes.
Expand All @@ -874,6 +875,10 @@ module.exports = {
excludeContentTypes,
});

customAttributes.forEach(({ key, value }) => {
query.$and.push({ [`customAttributes.${key}`]: value });
});

const siteId = input.siteId || site.id();
if (withSite && siteId) query['mutations.Website.primarySite'] = siteId;

Expand Down

0 comments on commit e11f283

Please sign in to comment.