Skip to content

Commit

Permalink
fix(api-headless-cms): add savedOn as cache parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
brunozoric committed Oct 31, 2023
1 parent eb3c6d9 commit 93a4996
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions packages/api-headless-cms/src/crud/contentModel.crud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ export const createModelsCrud = (params: CreateModelsCrudParams): CmsModelContex
tenant,
locale,
models: modelPlugins.map(({ contentModel: model }) => {
return `${model.modelId}#${model.pluralApiName}#${model.singularApiName}`;
return `${model.modelId}#${model.pluralApiName}#${model.singularApiName}#${
model.savedOn || "unknown"
}`;
})
});
return listPluginModelsCache.getOrSet(cacheKey, () => {
Expand Down Expand Up @@ -147,7 +149,11 @@ export const createModelsCrud = (params: CreateModelsCrudParams): CmsModelContex
tenant,
locale,
identity: context.security.isAuthorizationEnabled() ? getIdentity()?.id : undefined,
plugins: pluginModels.map(({ modelId }) => modelId)
plugins: pluginModels.map(model => {
return `${model.modelId}#${model.pluralApiName}#${model.singularApiName}#${
model.savedOn || "unknown"
}`;
})
});

return listAllModelsCache.getOrSet(cacheKey, async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-headless-cms/src/crud/contentModelGroup.crud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const createModelGroupsCrud = (params: CreateModelGroupsCrudParams): CmsG
tenant,
locale,
groups: pluginGroups.map(({ contentModelGroup: group }) => {
return `${group.id}#${group.slug}`;
return `${group.id}#${group.slug}#${group.savedOn || "unknown"}`;
})
});

Expand Down Expand Up @@ -110,7 +110,7 @@ export const createModelGroupsCrud = (params: CreateModelGroupsCrudParams): CmsG
locale,
identity: context.security.isAuthorizationEnabled() ? getIdentity()?.id : undefined,
groups: pluginGroups.map(group => {
return `${group.id}#${group.slug}`;
return `${group.id}#${group.slug}#${group.savedOn || "unknown"}`;
})
});

Expand Down

0 comments on commit 93a4996

Please sign in to comment.