Closed vabatta closed 4 years ago
Thank you so much for the PR. I'll test this as soon as I can.
@edwardanthony This misses the updates to README.md though. Would you be fine to do it yourself or shall I?
It's fine for now. I'll try to figure out the use case and update the README, I'll let you know if otherwise.
@edwardanthony An important note is that the rule of one is kept by the Schema
as the initialContext
is begin overwritten by the @Factory
methods.
See the issue for another possible feature #6 .
This is stale as the feature is rolled out already.
Description
This PR implements the change needed to add the
context
to the@Factory
decorator. The current behaviour is the following:DataFactory.createForClass(User).generate<InitialContext>(10, { ... });
@Factory
decorator the returned values are added to thecontext
as well as the final value with the class property key (e.g.@Factory() => { first, last } readonly name: string
thecontext
will be{ first, last, name }
)Refers to
Issue https://github.com/edwardanthony/nestjs-seeder/issues/6
Testing
Run the local sample.
For local MongoDB (you need docker).
Build.
Run the seeder.
Check your MongoDB.