Skip to content

Commit 9358315

Browse files
committed
Merge branch 'feature/v3' of https://github.com/w3tecch/express-typescript-boilerplate into feature/v3
2 parents e1d7892 + 796612d commit 9358315

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ scripts:
88
- npm start build
99
notifications:
1010
email: false
11+
env:
12+
- APP_ROUTE="http://localhost:3000"

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,20 @@ export class CreateUsers implements SeedsInterface {
287287
public async seed(factory: FactoryInterface): Promise<any> {
288288
await factory
289289
.get(User)
290+
.create(10);
291+
}
292+
293+
}
294+
```
295+
296+
With the second parameter in the `.get(<Entity>, <args>)` you are able to create different variations of entities.
297+
298+
```typescript
299+
export class CreateUsers implements SeedsInterface {
300+
301+
public async seed(factory: FactoryInterface): Promise<any> {
302+
await factory
303+
.get(User, 'admin')
290304
.create(1);
291305
}
292306

src/lib/seeds/FactoryInterface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface FactoryInterface {
99
/**
1010
* Returns an EntityFactoryInterface
1111
*/
12-
get<Entity>(entityClass: ObjectType<Entity>): EntityFactoryInterface<Entity>;
12+
get<Entity>(entityClass: ObjectType<Entity>, args: any[]): EntityFactoryInterface<Entity>;
1313
/**
1414
* Define an entity faker
1515
*/

0 commit comments

Comments
 (0)