Files
klz-cables.com/.pnpm-store/v10/files/38/c0dbaf2285d8651934d18ec673fcc95884724512926f3f2ba9cafb86fd0c34bb820b1d6c9c5878cadf947a1e1071ffd2929bbb707a77c5d09a51826cbf1b01
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

40 lines
1.3 KiB
Plaintext

import { combineWhereConstraints } from '../../utilities/combineWhereConstraints.js';
import { formatFolderOrDocumentItem } from './formatFolderOrDocumentItem.js';
export async function getOrphanedDocs({ collectionSlug, folderFieldName, req, where }) {
const { payload, user } = req;
const noParentFolderConstraint = {
or: [
{
[folderFieldName]: {
exists: false
}
},
{
[folderFieldName]: {
equals: null
}
}
]
};
const orphanedFolders = await payload.find({
collection: collectionSlug,
limit: 0,
overrideAccess: false,
req,
sort: payload.collections[collectionSlug]?.config.admin.useAsTitle,
user,
where: where ? combineWhereConstraints([
noParentFolderConstraint,
where
]) : noParentFolderConstraint
});
return orphanedFolders?.docs.map((doc)=>formatFolderOrDocumentItem({
folderFieldName,
isUpload: Boolean(payload.collections[collectionSlug]?.config.upload),
relationTo: collectionSlug,
useAsTitle: payload.collections[collectionSlug]?.config.admin.useAsTitle,
value: doc
})) || [];
}
//# sourceMappingURL=getOrphanedDocs.js.map