Includes all Phase 1 features: - Search-first navigation with auto-complete - Responsive reading interface (desktop/tablet/mobile) - 4 customization presets + full fine-tuning controls - Layered details panel with notes, bookmarks, highlights - Smart offline caching with IndexedDB and auto-sync - Full accessibility (WCAG 2.1 AA) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
86 lines
1.9 KiB
TypeScript
86 lines
1.9 KiB
TypeScript
import { CollectionConfig } from 'payload';
|
|
|
|
export const CheckoutSessions: CollectionConfig = {
|
|
slug: 'checkout-sessions',
|
|
admin: {
|
|
useAsTitle: 'sessionId',
|
|
defaultColumns: ['sessionId', 'user', 'type', 'status', 'createdAt'],
|
|
group: 'E-Commerce',
|
|
pagination: {
|
|
defaultLimit: 100,
|
|
},
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'sessionId',
|
|
type: 'text',
|
|
unique: true,
|
|
required: true,
|
|
index: true,
|
|
admin: {
|
|
readOnly: true,
|
|
},
|
|
},
|
|
{
|
|
name: 'user',
|
|
type: 'relationship',
|
|
relationTo: 'users',
|
|
required: true,
|
|
index: true,
|
|
},
|
|
{
|
|
name: 'price',
|
|
type: 'relationship',
|
|
relationTo: 'prices',
|
|
},
|
|
{
|
|
name: 'type',
|
|
type: 'select',
|
|
options: [
|
|
{ label: 'Subscription', value: 'subscription' },
|
|
{ label: 'Donation', value: 'donation' },
|
|
{ label: 'One-time Purchase', value: 'one-time' },
|
|
],
|
|
required: true,
|
|
index: true,
|
|
},
|
|
{
|
|
name: 'status',
|
|
type: 'select',
|
|
options: [
|
|
{ label: 'Pending', value: 'pending' },
|
|
{ label: 'Completed', value: 'completed' },
|
|
{ label: 'Expired', value: 'expired' },
|
|
{ label: 'Failed', value: 'failed' },
|
|
],
|
|
defaultValue: 'pending',
|
|
required: true,
|
|
index: true,
|
|
},
|
|
{
|
|
name: 'metadata',
|
|
type: 'json',
|
|
},
|
|
],
|
|
access: {
|
|
read: ({ req }) => {
|
|
if (!req.user) {
|
|
return false;
|
|
}
|
|
|
|
if (req.user.role === 'admin' || req.user.role === 'super-admin') {
|
|
return true;
|
|
}
|
|
|
|
return {
|
|
user: {
|
|
equals: req.user.id,
|
|
},
|
|
};
|
|
},
|
|
create: ({ req }) => req.user?.role === 'admin' || req.user?.role === 'super-admin',
|
|
update: ({ req }) => req.user?.role === 'admin' || req.user?.role === 'super-admin',
|
|
delete: ({ req }) => req.user?.role === 'super-admin',
|
|
},
|
|
};
|