fix: populate with find operation (#9087)
### What? Because of my error, we didn't pass `populate` to `findOperation` from the Local API. ### Why? `populate` must work for every operation that has `depth`. ### How? Passes `populate` in `operations/local/find.ts`, ensures it works with the test, checked that other operations pass it.
This commit is contained in:
@@ -67,8 +67,8 @@ export async function findLocal<
|
|||||||
overrideAccess = true,
|
overrideAccess = true,
|
||||||
page,
|
page,
|
||||||
pagination = true,
|
pagination = true,
|
||||||
|
populate,
|
||||||
select,
|
select,
|
||||||
// select,
|
|
||||||
showHiddenFields,
|
showHiddenFields,
|
||||||
sort,
|
sort,
|
||||||
where,
|
where,
|
||||||
@@ -94,6 +94,7 @@ export async function findLocal<
|
|||||||
overrideAccess,
|
overrideAccess,
|
||||||
page,
|
page,
|
||||||
pagination,
|
pagination,
|
||||||
|
populate,
|
||||||
req: await createLocalReq(options, payload),
|
req: await createLocalReq(options, payload),
|
||||||
select,
|
select,
|
||||||
showHiddenFields,
|
showHiddenFields,
|
||||||
|
|||||||
@@ -1817,6 +1817,25 @@ describe('Select', () => {
|
|||||||
id: aboutPage.id,
|
id: aboutPage.id,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const {
|
||||||
|
docs: [resultFind],
|
||||||
|
} = await payload.find({
|
||||||
|
collection: 'pages',
|
||||||
|
depth: 1,
|
||||||
|
populate: {
|
||||||
|
pages: {
|
||||||
|
additional: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
id: {
|
||||||
|
equals: aboutPage.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(resultFind).toStrictEqual(result)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user