-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathpapr.js
40 lines (37 loc) · 1012 Bytes
/
papr.js
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
import { schema, types } from '../esm/index.js';
import { papr, COLLECTIONS } from './setup.js';
const sampleSchema = schema(
{
age: types.number(),
binary: types.binary(),
city: types.string(),
firstName: types.string({ required: true }),
lastName: types.string({ required: true }),
localization: types.objectGeneric(types.string({ required: true })),
reference: types.objectId({ required: true }),
reviews: types.array(
types.object(
{
score: types.number(),
},
{
required: true,
}
)
),
salary: types.decimal(),
scores: types.array(types.number({ required: true })),
source: types.enum(COLLECTIONS, { required: true }),
url: types.string({
pattern: '^https?://.+$',
required: true,
}),
zip: types.number(),
},
{
defaults: { source: 'paprtests' },
timestamps: true,
}
);
const SamplePapr = papr.model('paprtests', sampleSchema);
export default SamplePapr;