Initial Commit
This commit is contained in:
@@ -0,0 +1,255 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
// 1. Beers Collection
|
||||
const beers = new Collection({
|
||||
name: "beers",
|
||||
type: "base",
|
||||
listRule: "",
|
||||
viewRule: "",
|
||||
});
|
||||
beers.fields.add(
|
||||
new TextField({ name: "name", required: true }),
|
||||
new TextField({ name: "slug", required: true }),
|
||||
new TextField({ name: "style", required: true }),
|
||||
new TextField({ name: "style_tag", required: true }),
|
||||
new TextField({ name: "description" }),
|
||||
new NumberField({ name: "ibu" }),
|
||||
new NumberField({ name: "abv" }),
|
||||
new TextField({ name: "pairings" }),
|
||||
new TextField({ name: "icon" }),
|
||||
new TextField({ name: "color_accent" }),
|
||||
new BoolField({ name: "on_tap" }),
|
||||
new NumberField({ name: "tap_number" }),
|
||||
new NumberField({ name: "keg_percentage" })
|
||||
);
|
||||
app.save(beers);
|
||||
|
||||
// 2. Food Items Collection
|
||||
const foodItems = new Collection({
|
||||
name: "food_items",
|
||||
type: "base",
|
||||
listRule: "",
|
||||
viewRule: "",
|
||||
});
|
||||
foodItems.fields.add(
|
||||
new TextField({ name: "name", required: true }),
|
||||
new TextField({ name: "category", required: true }),
|
||||
new TextField({ name: "description" }),
|
||||
new NumberField({ name: "price", required: true }),
|
||||
new BoolField({ name: "is_veg" }),
|
||||
new TextField({ name: "beer_pairing" })
|
||||
);
|
||||
app.save(foodItems);
|
||||
|
||||
// 3. Reservations Collection
|
||||
const reservations = new Collection({
|
||||
name: "reservations",
|
||||
type: "base",
|
||||
listRule: "@request.auth.id != ''",
|
||||
viewRule: "@request.auth.id != ''",
|
||||
createRule: "",
|
||||
});
|
||||
reservations.fields.add(
|
||||
new TextField({ name: "name", required: true }),
|
||||
new EmailField({ name: "email", required: true }),
|
||||
new TextField({ name: "phone", required: true }),
|
||||
new TextField({ name: "date", required: true }),
|
||||
new TextField({ name: "time", required: true }),
|
||||
new NumberField({ name: "guests", required: true }),
|
||||
new TextField({ name: "location", required: true }),
|
||||
new TextField({ name: "special_requests" }),
|
||||
new TextField({ name: "status" })
|
||||
);
|
||||
app.save(reservations);
|
||||
|
||||
// 4. Subscribers Collection
|
||||
const subscribers = new Collection({
|
||||
name: "subscribers",
|
||||
type: "base",
|
||||
listRule: "@request.auth.id != ''",
|
||||
createRule: "",
|
||||
});
|
||||
subscribers.fields.add(
|
||||
new EmailField({ name: "email", required: true }),
|
||||
new BoolField({ name: "active" })
|
||||
);
|
||||
app.save(subscribers);
|
||||
|
||||
// Seed Initial Beers (from Stitch Mockup)
|
||||
const seedBeers = [
|
||||
{
|
||||
name: "Weissbier",
|
||||
slug: "weissbier",
|
||||
style: "German Wheat Beer",
|
||||
style_tag: "Hefeweizen",
|
||||
description: "A classic German wheat beer with distinct notes of clove and banana. Unfiltered, hazy, and incredibly refreshing.",
|
||||
ibu: 15,
|
||||
abv: 5.2,
|
||||
pairings: "Citrus Salads, Mild Cheeses",
|
||||
icon: "local_drink",
|
||||
color_accent: "#ffb77b",
|
||||
on_tap: true,
|
||||
tap_number: 1,
|
||||
keg_percentage: 82,
|
||||
},
|
||||
{
|
||||
name: "Premium Pilsner",
|
||||
slug: "premium-pilsner",
|
||||
style: "Bohemian Lager",
|
||||
style_tag: "Lager",
|
||||
description: "Crisp, clean, and brilliantly clear. Brewed with noble hops for a floral aroma and a snappy, dry finish.",
|
||||
ibu: 35,
|
||||
abv: 4.8,
|
||||
pairings: "Spicy Appetizers, Seafood",
|
||||
icon: "sports_bar",
|
||||
color_accent: "#FFBF00",
|
||||
on_tap: true,
|
||||
tap_number: 2,
|
||||
keg_percentage: 64,
|
||||
},
|
||||
{
|
||||
name: "Industrial IPA",
|
||||
slug: "industrial-ipa",
|
||||
style: "India Pale Ale",
|
||||
style_tag: "IPA",
|
||||
description: "A hop-forward ale bursting with tropical fruit and pine aromas. Balanced by a sturdy malt backbone.",
|
||||
ibu: 65,
|
||||
abv: 6.5,
|
||||
pairings: "Rich Curries, Grilled Meats",
|
||||
icon: "liquor",
|
||||
color_accent: "#efbf78",
|
||||
on_tap: true,
|
||||
tap_number: 3,
|
||||
keg_percentage: 45,
|
||||
},
|
||||
{
|
||||
name: "Oatmeal Stout",
|
||||
slug: "oatmeal-stout",
|
||||
style: "Robust Dark Ale",
|
||||
style_tag: "Dark Ale",
|
||||
description: "Velvety smooth with rich flavors of espresso and dark chocolate. A comforting, robust brew.",
|
||||
ibu: 25,
|
||||
abv: 5.5,
|
||||
pairings: "Chocolate Desserts, BBQ",
|
||||
icon: "local_cafe",
|
||||
color_accent: "#4B3621",
|
||||
on_tap: true,
|
||||
tap_number: 4,
|
||||
keg_percentage: 30,
|
||||
},
|
||||
{
|
||||
name: "Belgian Dubbel",
|
||||
slug: "belgian-dubbel",
|
||||
style: "Abbey Ale",
|
||||
style_tag: "Belgian Ale",
|
||||
description: "Rich and complex with candied fruit, raisin, and caramel sweetness with a warm malty finish.",
|
||||
ibu: 22,
|
||||
abv: 7.0,
|
||||
pairings: "Roasted Duck, Aged Gouda",
|
||||
icon: "wine_bar",
|
||||
color_accent: "#b48948",
|
||||
on_tap: true,
|
||||
tap_number: 5,
|
||||
keg_percentage: 90,
|
||||
},
|
||||
{
|
||||
name: "Apple Cider",
|
||||
slug: "apple-cider",
|
||||
style: "Handcrafted Fruit Cider",
|
||||
style_tag: "Cider",
|
||||
description: "Pressed Himalayan apples fermented to a sparkling, crisp balance of tartness and crisp apple blossom.",
|
||||
ibu: 8,
|
||||
abv: 4.5,
|
||||
pairings: "Pork Ribs, Camembert, Salads",
|
||||
icon: "eco",
|
||||
color_accent: "#a2d1b7",
|
||||
on_tap: true,
|
||||
tap_number: 6,
|
||||
keg_percentage: 75,
|
||||
}
|
||||
];
|
||||
|
||||
for (const b of seedBeers) {
|
||||
const record = new Record(beers);
|
||||
for (const [key, val] of Object.entries(b)) {
|
||||
record.set(key, val);
|
||||
}
|
||||
app.save(record);
|
||||
}
|
||||
|
||||
// Seed Initial Food Items
|
||||
const seedFood = [
|
||||
{
|
||||
name: "Truffle Parmesan Fries",
|
||||
category: "Appetizers",
|
||||
description: "Hand-cut rustic fries tossed with white truffle oil, shaved Grana Padano, and fresh rosemary aioli.",
|
||||
price: 345,
|
||||
is_veg: true,
|
||||
beer_pairing: "Weissbier",
|
||||
},
|
||||
{
|
||||
name: "Smoked Chicken Wings",
|
||||
category: "Appetizers",
|
||||
description: "Hickory wood-smoked wings glazed with house-made IPA barbecue sauce, served with blue cheese dip.",
|
||||
price: 495,
|
||||
is_veg: false,
|
||||
beer_pairing: "Industrial IPA",
|
||||
},
|
||||
{
|
||||
name: "Wood-Fired Margherita Pizza",
|
||||
category: "Pizzas",
|
||||
description: "San Marzano tomatoes, fresh Fior di Latte mozzarella, fragrant sweet basil, and extra virgin olive oil.",
|
||||
price: 545,
|
||||
is_veg: true,
|
||||
beer_pairing: "Premium Pilsner",
|
||||
},
|
||||
{
|
||||
name: "Pepperoni & Hot Honey Pizza",
|
||||
category: "Pizzas",
|
||||
description: "Spicy artisanal pepperoni, fresh mozzarella, and a drizzle of chilli-infused organic honey.",
|
||||
price: 645,
|
||||
is_veg: false,
|
||||
beer_pairing: "Industrial IPA",
|
||||
},
|
||||
{
|
||||
name: "The Brewer's Smash Burger",
|
||||
category: "Mains",
|
||||
description: "Double tenderloin smashed patties, melted aged cheddar, caramelized beer onions, dill pickles on brioche.",
|
||||
price: 595,
|
||||
is_veg: false,
|
||||
beer_pairing: "Industrial IPA",
|
||||
},
|
||||
{
|
||||
name: "Grilled Cottage Cheese Steak",
|
||||
category: "Mains",
|
||||
description: "Herb-marinated paneer steak grilled over charcoal, roasted root vegetables, and a creamy pepper sauce.",
|
||||
price: 525,
|
||||
is_veg: true,
|
||||
beer_pairing: "Weissbier",
|
||||
},
|
||||
{
|
||||
name: "Dark Chocolate Stout Brownie",
|
||||
category: "Desserts",
|
||||
description: "Warm Belgian chocolate brownie infused with Oatmeal Stout, topped with Madagascan vanilla bean gelato.",
|
||||
price: 375,
|
||||
is_veg: true,
|
||||
beer_pairing: "Oatmeal Stout",
|
||||
}
|
||||
];
|
||||
|
||||
for (const f of seedFood) {
|
||||
const record = new Record(foodItems);
|
||||
for (const [key, val] of Object.entries(f)) {
|
||||
record.set(key, val);
|
||||
}
|
||||
app.save(record);
|
||||
}
|
||||
}, (app) => {
|
||||
const collections = ["subscribers", "reservations", "food_items", "beers"];
|
||||
for (const name of collections) {
|
||||
try {
|
||||
const col = app.findCollectionByNameOrId(name);
|
||||
app.delete(col);
|
||||
} catch (e) {}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user