-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenuManager.js
More file actions
194 lines (189 loc) · 5.49 KB
/
menuManager.js
File metadata and controls
194 lines (189 loc) · 5.49 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const dataFile = path.join(__dirname, "menuData.json");
// Initialize default menu data if file doesn't exist
const defaultMenu = {
appetizers: [
{
id: 1,
name: "Truffle Beef Carpaccio",
price: 28,
description:
"Thinly sliced Wagyu beef, shaved black summer truffles, caper berries, and 24-month aged Parmigiano Reggiano.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Beef+Carpaccio",
},
{
id: 2,
name: "Heirloom Burrata",
price: 24,
description:
"Creamy Puglian burrata, heirloom tomatoes, basil chlorophyll, balsamic pearls, and toasted pine nuts.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Burrata",
},
{
id: 3,
name: "Hokkaido Scallop Crudo",
price: 32,
description:
"Premium diver scallops, yuzu foam, micro shiso, and jalapeño ponzu.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Scallop+Crudo",
},
{
id: 4,
name: "Crispy Foie Gras",
price: 26,
description:
"Pan-seared duck liver, fig gastrique, brioche toast, and black garlic.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Foie+Gras",
},
],
mains: [
{
id: 5,
name: "Pan-Seared Wagyu Striploin",
price: 68,
description:
"A5 Japanese Wagyu, wagyu butter, roasted bone marrow, and seasonal vegetables.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Wagyu+Steak",
},
{
id: 6,
name: "Dover Sole Meunière",
price: 52,
description:
"Whole Dover sole, brown butter sauce, capers, and organic almonds.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Dover+Sole",
},
{
id: 7,
name: "Truffle Risotto",
price: 38,
description:
"Arborio rice, wild mushrooms, shaved black truffle, and Parmigiano Reggiano.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Truffle+Risotto",
},
{
id: 8,
name: "Roasted Duck Breast",
price: 45,
description:
"Mulard duck breast, cherry gastrique, parsnip purée, and micro herbs.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Duck+Breast",
},
{
id: 9,
name: "Lobster Thermidor",
price: 58,
description:
"Canadian lobster, cognac cream sauce, and Gruyère cheese gratine.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Lobster",
},
],
desserts: [
{
id: 10,
name: "Chocolate Soufflé",
price: 16,
description:
"Dark chocolate soufflé with Grand Marnier, gold leaf, and crème anglaise.",
image:
"https://placehold.co/400x300/1a1a1a/c5a059?text=Chocolate+Souffle",
},
{
id: 11,
name: "Vanilla Panna Cotta",
price: 14,
description:
"Silky vanilla panna cotta, fresh berries, and raspberry coulis.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Panna+Cotta",
},
{
id: 12,
name: "Pistachio Financier",
price: 12,
description:
"Delicate pistachio financier, pistachio cream, and crushed pistachio.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Pistachio",
},
{
id: 13,
name: "Fruit Tart Noire",
price: 18,
description: "Dark chocolate tart, seasonal fruits, and champagne jelly.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Fruit+Tart",
},
],
drinks: [
{
id: 14,
name: "Vintage Champagne",
price: 45,
description: "Krug Clos d'Ambonnay, vintage 2012.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Champagne",
},
{
id: 15,
name: "Premium Red Wine",
price: 55,
description: "Château Mouton Rothschild 1990, Bordeaux.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Red+Wine",
},
{
id: 16,
name: "Espresso Martini",
price: 18,
description:
"Premium vodka, coffee liqueur, fresh espresso, and cocoa dust.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Martini",
},
{
id: 17,
name: "Signature Cocktail",
price: 22,
description:
"Bespoke creation with top-shelf spirits and fresh ingredients.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Cocktail",
},
{
id: 18,
name: "Still Water",
price: 2,
description: "Premium bottled water.",
image: "https://placehold.co/400x300/1a1a1a/c5a059?text=Water",
},
],
};
// Load or initialize menu data
export function loadMenuData() {
try {
if (fs.existsSync(dataFile)) {
const data = fs.readFileSync(dataFile, "utf8");
return JSON.parse(data);
}
} catch (error) {
console.error("Error loading menu data:", error);
}
return defaultMenu;
}
// Save menu data to file
export function saveMenuData(data) {
try {
fs.writeFileSync(dataFile, JSON.stringify(data, null, 2));
return true;
} catch (error) {
console.error("Error saving menu data:", error);
return false;
}
}
// Get next ID
export function getNextId(menuData) {
let maxId = 0;
Object.values(menuData).forEach((categoryItems) => {
categoryItems.forEach((item) => {
if (item.id > maxId) maxId = item.id;
});
});
return maxId + 1;
}