While we can use `joins`, `select`, `populate`, `depth` or `draft` on auth collections when finding or finding by ID, these arguments weren't supported for `/me` which meant that in some situations like in our ecommerce template we couldn't optimise these calls. A workaround would be to make a call to `/me` and then get the user ID to then use for a `findByID` operation.
22 lines
360 B
TypeScript
22 lines
360 B
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
export const UsersCollection: CollectionConfig = {
|
|
slug: 'users',
|
|
admin: {
|
|
useAsTitle: 'email',
|
|
},
|
|
auth: true,
|
|
fields: [
|
|
{
|
|
name: 'name',
|
|
type: 'text',
|
|
defaultValue: 'Payload dev',
|
|
},
|
|
{
|
|
name: 'number',
|
|
type: 'number',
|
|
defaultValue: 42,
|
|
},
|
|
],
|
|
}
|