mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-10 00:43:23 +00:00
22 lines
402 B
TypeScript
22 lines
402 B
TypeScript
import type { Payload } from 'payload'
|
|
|
|
import { devUser } from './helpers/credentials.js'
|
|
|
|
export const seed = async (payload: Payload) => {
|
|
const { totalDocs } = await payload.count({
|
|
collection: 'users',
|
|
where: {
|
|
email: {
|
|
equals: devUser.email,
|
|
},
|
|
},
|
|
})
|
|
|
|
if (!totalDocs) {
|
|
await payload.create({
|
|
collection: 'users',
|
|
data: devUser,
|
|
})
|
|
}
|
|
}
|