mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-10 02:43:24 +00:00
- Remove `seedBillingData` function for sample data creation - Update refunds, invoices, and payments collections to use pluginConfig for dynamic overrides - Introduce utility functions like `extractSlug` for customizable collection slugs - Streamline customer relation and data extractor logic across collections
30 lines
617 B
TypeScript
30 lines
617 B
TypeScript
import type { Payload } from 'payload'
|
|
|
|
import { devUser } from './helpers/credentials'
|
|
|
|
export const seed = async (payload: Payload) => {
|
|
// Seed default user first
|
|
const { totalDocs } = await payload.count({
|
|
collection: 'users',
|
|
where: {
|
|
email: {
|
|
equals: devUser.email,
|
|
},
|
|
},
|
|
})
|
|
|
|
if (!totalDocs) {
|
|
await payload.create({
|
|
collection: 'users',
|
|
data: devUser,
|
|
})
|
|
}
|
|
|
|
// Seed billing sample data
|
|
await seedBillingData(payload)
|
|
}
|
|
|
|
async function seedBillingData(payload: Payload): Promise<void> {
|
|
payload.logger.info('Seeding billing sample data...')
|
|
}
|