Skip to content

Commit

Permalink
fixup! fix(core): remove bundle slugs in favor of bundle id (#7427)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge authored and juice49 committed Oct 7, 2024
1 parent 3957e82 commit c9dc8f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ const getFetchQuery = (bundleIds: string[]) => {

return bundleIds.reduce(
({subquery: accSubquery, projection: accProjection}, bundleId) => {
// this safeguards against bundle ids generated from UUIDs
const safeKey = getSafeKey(bundleId)
// get a version of the id that is safe to use as key in objects
const safeId = getSafeKey(bundleId)

const subquery = `${accSubquery}"${safeKey}": *[_id in path("versions.${bundleId}.*")]{_updatedAt } | order(_updatedAt desc),`
const subquery = `${accSubquery}"${safeId}": *[_id in path("versions.${bundleId}.*")]{_updatedAt } | order(_updatedAt desc),`

// conforms to BundlesMetadata
const projection = `${accProjection}"${safeKey}": {
"updatedAt": ${safeKey}[0]._updatedAt,
"documentCount": count(${safeKey})
const projection = `${accProjection}"${bundleId}": {
"updatedAt": ${safeId}[0]._updatedAt,
"documentCount": count(${safeId})
},`

return {subquery, projection}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type ResponseWrapper = {response: BundleDocument[]}
export const SORT_FIELD = '_createdAt'
export const SORT_ORDER = 'desc'

const QUERY_FILTERS = [`_type == "bundle"`]
const QUERY_FILTERS = [`_type == "release"`]

// TODO: Extend the projection with the fields needed
const QUERY_PROJECTION = `{
Expand Down

0 comments on commit c9dc8f0

Please sign in to comment.