ChickenKyiv / loopback-tutor-intern-10

GNU General Public License v3.0
0 stars 2 forks source link

import #5

Closed atherdon closed 6 years ago

atherdon commented 6 years ago

this is the most recent version of import script that i did: https://github.com/ChickenKyiv/recipe-search-api/tree/master/bin

how to run this script: https://github.com/ChickenKyiv/recipe-search-api/blob/master/package.json#L15

not remember - but it can be broken at this moment. If it will crash - buzz me - and i'll finish it - cause i'm lazy to do it.

atherdon commented 6 years ago

for a few tables - you need to update code. users and Roles must be assigned together. some information you can see here: https://github.com/GroceriStar/groceristar/blob/master/bin/grocery/users.js it's an old version, but you'll be able to see a main logic. and this file is called here: https://github.com/GroceriStar/groceristar/blob/master/bin/grocery/import.js#L51

atherdon commented 6 years ago

Did you test - import working well?

louisevdb84 commented 6 years ago

busy looking at it. Get Error: Cannot migrate models not attached to this datasource: Attribute. Should I replace this code in 001-import.js async.parallel({ attributes : async.apply(helper.create, options, Attribute),

by deleting attributes and rather add each table like this:

async.parallel({ campground: async.apply(helper.create, options, Campground), reservation : async.apply(helper.create, options, Reservation), ETC. Because I dont know what purpose the Attributes table has in my code.

atherdon commented 6 years ago

you don't have that table. this is just copy-pasted from serach-api. delete it.

atherdon commented 6 years ago

yes, 001-import.js is the main file, where you work with import logic. feel free to update it. you can also improve it - it'll be cool for other backenders work

louisevdb84 commented 6 years ago

Import is now working without any errors

atherdon commented 6 years ago

after reviewing that files, maybe you have suggestions about how we can improve the structure/logic of this script?

louisevdb84 commented 6 years ago

This was the first time I saw an import script. don't really know how to improve on it.

atherdon commented 6 years ago

ok, we'll work on it few times, so maybe later we'll improve it