mean-expert-official / fireloop.io

Modern Real-Time Platform by MEAN Expert
Other
172 stars 36 forks source link

Question model relationship #78

Closed ElHupeke closed 7 years ago

ElHupeke commented 7 years ago

What type of issue are you creating?

What version of this module are you using?

I started with plain models. Works fine. Well, it works great! I love fireloop and want to use it for my apps. Now I want to use model relations between the models. I saw some documentation with slc loopback model:relations, but I can't get a good description/explantation how to start. What is the best way to do this? I created the models with Fireloop, because I get the .ts files. Do I have to use the slc relation method for now to define the 1 to many relations ships? Are there any samples or documentation how to start with this. Can you help me? Thank you.

mikkoh85 commented 7 years ago

I have similar question. I made simple Fireloop project and added models with command: fireloop model [ModelName]. But there seems not to be fireloop relation command or anything like that. Or is it so that FireLoop uses no relations? I am experienced user with LoopBack, but just starting to learn FireLoop..

mikkoh85 commented 7 years ago

I found out that I need to write relations by hand into models' .json file. I guess there is not yet cli command similar to Loopback's lb relation in FireLoop.

brannon-darby commented 7 years ago

@ElHupeke - i believe you joined our slack community and have this working now?

@mikkoh85 - fireloop model is simply an extension of loopback's lb model to generate a typescript version of the model.js. you should use lb <command> for all other loopback items. to create relations, use lb relation or manually update the .json file. after creating relations, use fireloop sdk from the root dir to re-generate your sdk with the associated relation methods.

please join our slack community if you need any help.

brannon-darby commented 7 years ago

example relations here:

https://github.com/mean-expert-official/fire-starter/blob/admin/api/common/models/fire-user.json#L36-L51

mikkoh85 commented 7 years ago

Thanks for answers. I guess I will join to the slack community. I remember trying command lb relation, but that returned an error. I may do this again today if you want more info.

ElHupeke commented 7 years ago

Dear Brannon,

It's working fantastic! I have a great time here and did some cool things today. I think I will get a working tournament application for the European Tang Soo Do championship :-)

Kind regards,

Huub de Groot

Van: Brannon N. Darby II notifications@github.com Aan: mean-expert-official/fireloop.io fireloop.io@noreply.github.com Cc: ElHupeke ElHupeke@degroot.whyi.org, Mention mention@noreply.github.com Verzonden: 17-4-2017 4:21 Onderwerp: Re: [mean-expert-official/fireloop.io] Question model relationship (#78)

@ElHupeke - i believe you joined our slack community and have this working now? @mikkoh85 - fireloop model is simply an extension of loopback's lb model to generate a typescript version of the model.js. you should use lb <command for all other loopback items. to create relations, use lb relation or manually update the .json file. after creating relations, use fireloop sdk from the root dir to re-generate your sdk with the associated relation methods. please join our slack community if you need any help. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.