export function apiField(label: string, key: string, type: string, rest: object = {}) { return { key, label, type, required: false, unique: false, default: null, min: null, max: null, options: null, relation: null, ...rest, } } export const eventsFields = [ apiField('Title', 'title', 'text', { required: true, unique: true, max: 80, options: [], }), apiField('Starts on', 'starts_on', 'date', { required: true, options: [] }), apiField('Ends on', 'ends_on', 'date', { options: [] }), apiField('Online', 'online', 'boolean', { default: false, options: [] }), apiField('Capacity', 'capacity', 'number', { min: 1, max: 5000, options: [], }), apiField('Category', 'category', 'select', { options: ['Talk', 'Workshop', 'Meetup'], }), apiField('Description', 'description', 'richtext', { options: [] }), ] export const recipesFields = [ apiField('Title', 'title', 'text', { required: true, options: [] }), apiField('Servings', 'servings', 'number', { min: 1, options: [] }), apiField('Vegetarian', 'vegetarian', 'boolean', { options: [] }), apiField('Method', 'method', 'richtext', { options: [] }), ]