0

I am trying to create some fixtures for my Loopback API using loopback-component-fixtures. https://www.npmjs.com/package/loopback-component-fixtures

Although I am able to create fixtures for simple model entities, I am unable to create relations. e.g I can create clients and I can create orders, but I can't create a client with 1 or many orders.

I could not find this in the documentation and I tried creating the JSON with the relation within but it simply ignores it.

smorhaim
  • 778
  • 1
  • 9
  • 24

1 Answers1

0

From the component creator:

You should be fine just setting foreign keys and to simplify the process set id’s manually on each record. This also makes life easier for unit tests. Beware that when setting the id’s in the fixture data that new records created on that model will probably be rejected until the auto increment catches up.

smorhaim
  • 778
  • 1
  • 9
  • 24