-
Notifications
You must be signed in to change notification settings - Fork 0
/
core.ts
65 lines (50 loc) · 1.27 KB
/
core.ts
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import prisma from '@/lib/prisma';
async function generateFormat(displayName: string) {
await prisma.format.create({
data: {
displayName,
},
});
}
async function generateFormats() {
const formats = ['Hardcover', 'Mass Market Paperback', 'Trade Paperback'];
await Promise.all(formats.map(generateFormat));
}
async function generateGenre(displayName: string) {
await prisma.genre.create({
data: {
displayName,
},
});
}
async function generateGenres() {
const genres = [
// Fiction
'Fantasy',
'Literary Fiction',
'Romance',
'Science Fiction',
// Young Adult
'YA Fantasy',
// Kids
'Middle Grade',
// Non-Fiction
'Business and Finance',
'Cookbooks',
];
await Promise.all(genres.map(generateGenre));
}
async function generateInventoryAdjustmentReason(displayName: string) {
await prisma.inventoryAdjustmentReason.create({
data: { displayName },
});
}
async function generateInventoryAdjustmentReasons() {
const reasons = ['Incorrect Inventory', 'Damage', 'Theft'];
await Promise.all(reasons.map(generateInventoryAdjustmentReason));
}
export default async function generateCoreSeeds() {
await generateFormats();
await generateGenres();
await generateInventoryAdjustmentReasons();
}