edwardanthony / nestjs-seeder

An extension library for NestJS to perform seeding.
MIT License
102 stars 21 forks source link

Implement `context` for `@Factory` decorator #7

Closed vabatta closed 4 years ago

vabatta commented 4 years ago

Description

This PR implements the change needed to add the context to the @Factory decorator. The current behaviour is the following:

Refers to

Issue https://github.com/edwardanthony/nestjs-seeder/issues/6

Testing

Run the local sample.

$> cd sample

For local MongoDB (you need docker).

$> docker-compose up -d

Build.

$> npm run build

Run the seeder.

$> node dist/sample/src/seeder

Check your MongoDB.

edwardanthony commented 4 years ago

Thank you so much for the PR. I'll test this as soon as I can.

vabatta commented 4 years ago

@edwardanthony This misses the updates to README.md though. Would you be fine to do it yourself or shall I?

edwardanthony commented 4 years ago

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.

vabatta commented 4 years ago

@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 .

vabatta commented 4 years ago

This is stale as the feature is rolled out already.