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

Commit

Permalink
Use customAttributes over import entity.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinsina committed Nov 30, 2021
1 parent 20d085b commit eec3d41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,6 @@ input ContentEventDatesMutationInput {
}
input AllPublishedContentQueryInput {
"Allows for return of the _import.entity field if requested"
importEntity: String
"Limits results to content with a primary site matching the current site context "
withSite: Boolean = true
"A websiteSite identifier. If present, overrides the current site context."
Expand All @@ -487,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 @@ -568,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,7 +861,7 @@ module.exports = {
beginning,
ending,
withSite,
importEntity,
customAttributes,
} = input;

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

if (importEntity) query['_import.entity'] = importEntity;
customAttributes.forEach(({ key, value }) => {
const fullKeyPath = `customAttributes.${key}`;
query.$and.push({ [fullKeyPath]: value });
});

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

0 comments on commit eec3d41

Please sign in to comment.