fix: removes select argument from create operation db calls (#13841)
Extension of https://github.com/payloadcms/payload/pull/13809 Fixes https://github.com/payloadcms/payload/issues/13769 Removes select arg from create operation and allows afterRead to filter out select fields. Leaving the select argument will create documents with only the selected data.
This commit is contained in:
@@ -12,7 +12,6 @@ type Args = {
|
|||||||
password: string
|
password: string
|
||||||
payload: Payload
|
payload: Payload
|
||||||
req: PayloadRequest
|
req: PayloadRequest
|
||||||
select?: SelectType
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const registerLocalStrategy = async ({
|
export const registerLocalStrategy = async ({
|
||||||
@@ -21,7 +20,6 @@ export const registerLocalStrategy = async ({
|
|||||||
password,
|
password,
|
||||||
payload,
|
payload,
|
||||||
req,
|
req,
|
||||||
select,
|
|
||||||
}: Args): Promise<Record<string, unknown>> => {
|
}: Args): Promise<Record<string, unknown>> => {
|
||||||
const loginWithUsername = collection?.auth?.loginWithUsername
|
const loginWithUsername = collection?.auth?.loginWithUsername
|
||||||
|
|
||||||
@@ -95,6 +93,5 @@ export const registerLocalStrategy = async ({
|
|||||||
salt,
|
salt,
|
||||||
},
|
},
|
||||||
req,
|
req,
|
||||||
select,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -267,14 +267,12 @@ export const createOperation = async <
|
|||||||
password: data.password as string,
|
password: data.password as string,
|
||||||
payload: req.payload,
|
payload: req.payload,
|
||||||
req,
|
req,
|
||||||
select,
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
doc = await payload.db.create({
|
doc = await payload.db.create({
|
||||||
collection: collectionConfig.slug,
|
collection: collectionConfig.slug,
|
||||||
data: resultWithLocales,
|
data: resultWithLocales,
|
||||||
req,
|
req,
|
||||||
select,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user