initial commit
This commit is contained in:
358
scripts/seed.js
Normal file
358
scripts/seed.js
Normal file
@@ -0,0 +1,358 @@
|
||||
const db = require('../models');
|
||||
|
||||
const filipinoFoods = [
|
||||
// Rice (Kanin)
|
||||
{
|
||||
name: 'White Rice',
|
||||
name_tagalog: 'Kanin',
|
||||
category: 'kanin',
|
||||
calories: 206,
|
||||
protein_g: 4.3,
|
||||
carbs_g: 45,
|
||||
fat_g: 0.4,
|
||||
serving_description: '1 cup cooked',
|
||||
serving_size_g: 158
|
||||
},
|
||||
{
|
||||
name: 'Fried Rice',
|
||||
name_tagalog: 'Sinangag',
|
||||
category: 'kanin',
|
||||
calories: 280,
|
||||
protein_g: 5,
|
||||
carbs_g: 42,
|
||||
fat_g: 10,
|
||||
serving_description: '1 cup',
|
||||
serving_size_g: 170
|
||||
},
|
||||
|
||||
// Main Dishes (Ulam)
|
||||
{
|
||||
name: 'Chicken Adobo',
|
||||
name_tagalog: 'Adobong Manok',
|
||||
category: 'ulam',
|
||||
calories: 350,
|
||||
protein_g: 35,
|
||||
carbs_g: 5,
|
||||
fat_g: 20,
|
||||
serving_description: '1 serving (2 pieces)',
|
||||
serving_size_g: 200
|
||||
},
|
||||
{
|
||||
name: 'Pork Sinigang',
|
||||
name_tagalog: 'Sinigang na Baboy',
|
||||
category: 'sabaw',
|
||||
calories: 280,
|
||||
protein_g: 25,
|
||||
carbs_g: 10,
|
||||
fat_g: 15,
|
||||
serving_description: '1 bowl',
|
||||
serving_size_g: 350
|
||||
},
|
||||
{
|
||||
name: 'Chicken Tinola',
|
||||
name_tagalog: 'Tinolang Manok',
|
||||
category: 'sabaw',
|
||||
calories: 200,
|
||||
protein_g: 28,
|
||||
carbs_g: 8,
|
||||
fat_g: 6,
|
||||
serving_description: '1 bowl',
|
||||
serving_size_g: 350
|
||||
},
|
||||
{
|
||||
name: 'Bicol Express',
|
||||
name_tagalog: 'Bicol Express',
|
||||
category: 'ulam',
|
||||
calories: 400,
|
||||
protein_g: 20,
|
||||
carbs_g: 10,
|
||||
fat_g: 32,
|
||||
serving_description: '1 serving',
|
||||
serving_size_g: 200
|
||||
},
|
||||
{
|
||||
name: 'Pork Sisig',
|
||||
name_tagalog: 'Sisig',
|
||||
category: 'ulam',
|
||||
calories: 450,
|
||||
protein_g: 25,
|
||||
carbs_g: 8,
|
||||
fat_g: 35,
|
||||
serving_description: '1 serving',
|
||||
serving_size_g: 180
|
||||
},
|
||||
{
|
||||
name: 'Menudo',
|
||||
name_tagalog: 'Menudo',
|
||||
category: 'ulam',
|
||||
calories: 320,
|
||||
protein_g: 22,
|
||||
carbs_g: 12,
|
||||
fat_g: 20,
|
||||
serving_description: '1 serving',
|
||||
serving_size_g: 200
|
||||
},
|
||||
{
|
||||
name: 'Kare-Kare',
|
||||
name_tagalog: 'Kare-Kare',
|
||||
category: 'ulam',
|
||||
calories: 380,
|
||||
protein_g: 24,
|
||||
carbs_g: 18,
|
||||
fat_g: 25,
|
||||
serving_description: '1 serving',
|
||||
serving_size_g: 250
|
||||
},
|
||||
{
|
||||
name: 'Lechon Kawali',
|
||||
name_tagalog: 'Lechon Kawali',
|
||||
category: 'ulam',
|
||||
calories: 500,
|
||||
protein_g: 30,
|
||||
carbs_g: 2,
|
||||
fat_g: 42,
|
||||
serving_description: '1 serving',
|
||||
serving_size_g: 150
|
||||
},
|
||||
{
|
||||
name: 'Pork Nilaga',
|
||||
name_tagalog: 'Nilagang Baboy',
|
||||
category: 'sabaw',
|
||||
calories: 280,
|
||||
protein_g: 28,
|
||||
carbs_g: 12,
|
||||
fat_g: 14,
|
||||
serving_description: '1 bowl',
|
||||
serving_size_g: 350
|
||||
},
|
||||
{
|
||||
name: 'Beef Bulalo',
|
||||
name_tagalog: 'Bulalo',
|
||||
category: 'sabaw',
|
||||
calories: 350,
|
||||
protein_g: 32,
|
||||
carbs_g: 8,
|
||||
fat_g: 22,
|
||||
serving_description: '1 bowl',
|
||||
serving_size_g: 400
|
||||
},
|
||||
|
||||
// Vegetables (Gulay)
|
||||
{
|
||||
name: 'Pinakbet',
|
||||
name_tagalog: 'Pinakbet',
|
||||
category: 'gulay',
|
||||
calories: 150,
|
||||
protein_g: 5,
|
||||
carbs_g: 20,
|
||||
fat_g: 6,
|
||||
serving_description: '1 cup',
|
||||
serving_size_g: 200
|
||||
},
|
||||
{
|
||||
name: 'Laing',
|
||||
name_tagalog: 'Laing',
|
||||
category: 'gulay',
|
||||
calories: 180,
|
||||
protein_g: 6,
|
||||
carbs_g: 15,
|
||||
fat_g: 12,
|
||||
serving_description: '1 cup',
|
||||
serving_size_g: 180
|
||||
},
|
||||
{
|
||||
name: 'Ginisang Monggo',
|
||||
name_tagalog: 'Ginisang Monggo',
|
||||
category: 'gulay',
|
||||
calories: 200,
|
||||
protein_g: 12,
|
||||
carbs_g: 30,
|
||||
fat_g: 4,
|
||||
serving_description: '1 cup',
|
||||
serving_size_g: 220
|
||||
},
|
||||
|
||||
// Breakfast (Almusal)
|
||||
{
|
||||
name: 'Beef Tapa with Rice and Egg',
|
||||
name_tagalog: 'Tapsilog',
|
||||
category: 'almusal',
|
||||
calories: 650,
|
||||
protein_g: 45,
|
||||
carbs_g: 60,
|
||||
fat_g: 25,
|
||||
serving_description: '1 plate',
|
||||
serving_size_g: 400
|
||||
},
|
||||
{
|
||||
name: 'Longganisa with Rice and Egg',
|
||||
name_tagalog: 'Longsilog',
|
||||
category: 'almusal',
|
||||
calories: 700,
|
||||
protein_g: 38,
|
||||
carbs_g: 65,
|
||||
fat_g: 32,
|
||||
serving_description: '1 plate',
|
||||
serving_size_g: 420
|
||||
},
|
||||
{
|
||||
name: 'Tocino with Rice and Egg',
|
||||
name_tagalog: 'Tocilog',
|
||||
category: 'almusal',
|
||||
calories: 680,
|
||||
protein_g: 42,
|
||||
carbs_g: 62,
|
||||
fat_g: 28,
|
||||
serving_description: '1 plate',
|
||||
serving_size_g: 400
|
||||
},
|
||||
{
|
||||
name: 'Fried Egg',
|
||||
name_tagalog: 'Pritong Itlog',
|
||||
category: 'almusal',
|
||||
calories: 90,
|
||||
protein_g: 6,
|
||||
carbs_g: 1,
|
||||
fat_g: 7,
|
||||
serving_description: '1 egg',
|
||||
serving_size_g: 50
|
||||
},
|
||||
|
||||
// Snacks (Meryenda)
|
||||
{
|
||||
name: 'Pandesal',
|
||||
name_tagalog: 'Pandesal',
|
||||
category: 'meryenda',
|
||||
calories: 120,
|
||||
protein_g: 3,
|
||||
carbs_g: 22,
|
||||
fat_g: 2,
|
||||
serving_description: '1 piece',
|
||||
serving_size_g: 40
|
||||
},
|
||||
{
|
||||
name: 'Turon',
|
||||
name_tagalog: 'Turon',
|
||||
category: 'meryenda',
|
||||
calories: 180,
|
||||
protein_g: 2,
|
||||
carbs_g: 35,
|
||||
fat_g: 5,
|
||||
serving_description: '1 piece',
|
||||
serving_size_g: 80
|
||||
},
|
||||
{
|
||||
name: 'Bibingka',
|
||||
name_tagalog: 'Bibingka',
|
||||
category: 'meryenda',
|
||||
calories: 220,
|
||||
protein_g: 5,
|
||||
carbs_g: 38,
|
||||
fat_g: 6,
|
||||
serving_description: '1 piece',
|
||||
serving_size_g: 100
|
||||
},
|
||||
{
|
||||
name: 'Puto',
|
||||
name_tagalog: 'Puto',
|
||||
category: 'meryenda',
|
||||
calories: 90,
|
||||
protein_g: 2,
|
||||
carbs_g: 18,
|
||||
fat_g: 1,
|
||||
serving_description: '1 piece',
|
||||
serving_size_g: 40
|
||||
},
|
||||
{
|
||||
name: 'Lumpia',
|
||||
name_tagalog: 'Lumpia',
|
||||
category: 'meryenda',
|
||||
calories: 100,
|
||||
protein_g: 4,
|
||||
carbs_g: 10,
|
||||
fat_g: 5,
|
||||
serving_description: '1 piece',
|
||||
serving_size_g: 50
|
||||
},
|
||||
{
|
||||
name: 'Banana Cue',
|
||||
name_tagalog: 'Banana Cue',
|
||||
category: 'meryenda',
|
||||
calories: 150,
|
||||
protein_g: 1,
|
||||
carbs_g: 32,
|
||||
fat_g: 4,
|
||||
serving_description: '1 piece',
|
||||
serving_size_g: 100
|
||||
},
|
||||
|
||||
// Proteins
|
||||
{
|
||||
name: 'Grilled Tilapia',
|
||||
name_tagalog: 'Inihaw na Tilapia',
|
||||
category: 'ulam',
|
||||
calories: 180,
|
||||
protein_g: 32,
|
||||
carbs_g: 0,
|
||||
fat_g: 5,
|
||||
serving_description: '1 whole fish',
|
||||
serving_size_g: 150
|
||||
},
|
||||
{
|
||||
name: 'Grilled Chicken',
|
||||
name_tagalog: 'Inihaw na Manok',
|
||||
category: 'ulam',
|
||||
calories: 280,
|
||||
protein_g: 40,
|
||||
carbs_g: 0,
|
||||
fat_g: 13,
|
||||
serving_description: '1 breast',
|
||||
serving_size_g: 150
|
||||
},
|
||||
{
|
||||
name: 'Fried Bangus',
|
||||
name_tagalog: 'Pritong Bangus',
|
||||
category: 'ulam',
|
||||
calories: 220,
|
||||
protein_g: 28,
|
||||
carbs_g: 0,
|
||||
fat_g: 12,
|
||||
serving_description: '1 piece',
|
||||
serving_size_g: 120
|
||||
}
|
||||
];
|
||||
|
||||
async function seed() {
|
||||
try {
|
||||
await db.sequelize.sync();
|
||||
|
||||
let addedCount = 0;
|
||||
|
||||
for (const foodData of filipinoFoods) {
|
||||
// Check if already exists
|
||||
const existing = await db.FoodItem.findOne({
|
||||
where: {
|
||||
name: foodData.name,
|
||||
is_filipino: true
|
||||
}
|
||||
});
|
||||
|
||||
if (!existing) {
|
||||
await db.FoodItem.create({
|
||||
...foodData,
|
||||
source: 'filipino',
|
||||
is_filipino: true
|
||||
});
|
||||
addedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Successfully added ${addedCount} Filipino foods to the database!`);
|
||||
} catch (error) {
|
||||
console.error('Error seeding Filipino foods:', error);
|
||||
} finally {
|
||||
await db.sequelize.close();
|
||||
}
|
||||
}
|
||||
|
||||
seed();
|
||||
Reference in New Issue
Block a user