You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Backend/routes/index.js
+309Lines changed: 309 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,11 @@ var router = express.Router();
3
3
letpuppeteer=require('puppeteer');
4
4
varcors=require('cors');
5
5
varRaven=require('raven');
6
+
letmulter=require('multer');
7
+
letfs=require('fs-extra');
8
+
letmdb=require('mdb');
9
+
letextract=require('extract-zip');
10
+
letsqlite3=require('sqlite3');
6
11
7
12
// DB
8
13
varOp=require("sequelize").Op;
@@ -212,4 +217,308 @@ router.get(
212
217
}).catch(next);
213
218
});
214
219
220
+
lettablesNeeded=[
221
+
// "t_attachment", //2x unused
222
+
"t_authornote",// seems to be a cross between description (short) and notes (long) - sometimes very long (multiple entries per recipe, divided paragraph)
223
+
// "t_cookbook_x", // unused from this db afaik
224
+
// "t_favorite_x", //2x unused
225
+
// "t_favoritefolder", //2x unused
226
+
// "t_glossaryitem",
227
+
// "t_groceryaisle",
228
+
// "t_grocerylistitemrecipe",
229
+
"t_image",// Holds filenames for all images
230
+
// "t_ingredient",
231
+
// "t_ingredientattachment",
232
+
// "t_ingredientautocomplete",
233
+
// "t_ingredientfolder",
234
+
// "t_ingredientfolder_x",
235
+
// "t_ingredientimage",
236
+
// "t_meal", // Holds meal names with an abbreviation. No reference to any other table
237
+
// "t_measure",
238
+
// "t_measure_x",
239
+
// "t_menu", // Holds menu info - has some "types" info that might be useful for labelling
240
+
// "t_menu_x", // unused
241
+
// "t_menuimage",
242
+
"t_recipe",
243
+
// "t_recipe_x", //2x unused
244
+
// "t_recipeattachment", // 2x unused
245
+
"t_recipeimage",// bidirectional relation table between recipe and image
246
+
"t_recipeingredient",
247
+
// "t_recipemeasure",
248
+
"t_recipeprocedure",
249
+
// "t_recipereview",
250
+
// "t_technique",
251
+
// "t_recipetechnique",
252
+
"t_recipetip",
253
+
// "t_recipetype", // seems to store category names, but no discernable relationship to recipe table - better to use recipetypes field in recipe itself (comma separated)
254
+
// "t_recipetype_x", //2x unused
255
+
// "t_grocerylistitem",
256
+
// "t_ingredient_x", //2x unused
257
+
// "t_ingredientmeasure", //not entirely clear - looks like a relationship table between ingredients and measurements
258
+
// "t_recipemedia" //2x unused (or barely used)
259
+
]
260
+
261
+
router.post(
262
+
'/import/livingcookbook',
263
+
cors(),
264
+
MiddlewareService.validateSession(['user']),
265
+
MiddlewareService.validateUser,
266
+
multer({
267
+
dest: '/tmp/chefbook-lcb-import/',
268
+
}).single('lcbdb'),
269
+
async(req,res,next)=>{
270
+
if(!req.file){
271
+
res.status(400).send("Must include a file with the key lcbdb")
0 commit comments