Files
payload-billing/dev/seed.ts
Bas van den Aakster 0308e30ebd refactor: Replace hardcoded billing data seeding with plugin-configurable collection overrides
- 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
2025-09-16 00:06:18 +02:00

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...')
}