-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathfoods.ts
More file actions
51 lines (49 loc) · 1.32 KB
/
foods.ts
File metadata and controls
51 lines (49 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { builder } from '../helper'
export const foodsCollection = builder.collection('foods', {
slug: 'foods',
primaryField: 'id',
fields: builder.fields('foods', (fb) => ({
id: fb.columns('id', {
type: 'text',
label: 'Food ID',
placeholder: 'ID',
default: '123',
}),
name: fb.columns('name', {
type: 'text',
label: 'Food name',
create: 'enabled',
update: 'disabled',
}),
isCooked: fb.columns('isCooked', {
type: 'checkbox',
label: 'Food cooked',
default: true,
description: 'Is the food cooked?',
}),
cookingTypes: fb.columns('cookingTypes', {
type: 'selectText',
label: 'Cooking types',
options: (args) => {
const res = args.db._.schema?.foods.columns.cookingTypes.enumValues || []
return res.map((v) => ({ label: v, value: v }))
},
}),
cookingDuration: fb.columns('cookingDuration', {
type: 'number',
label: 'Cooking duration',
placeholder: 'Duration (Seconds)',
default: 10,
}),
cookingDate: fb.columns('cookingDate', {
type: 'date',
label: 'Cooking date',
default: new Date('2025-04-24'),
}),
cookingTime: fb.columns('cookingTime', {
type: 'time',
label: 'Cooking time',
default: new Date(),
}),
})),
})