-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from SecJS/feat/len-factories-base-service
feat: Add factory class and base service impl in templates
- Loading branch information
Showing
31 changed files
with
235 additions
and
490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Inject, Injectable } from '@nestjs/common' | ||
import { Factory } from '@secjs/base/database/Factory' | ||
import { <%= namePascal %>Seeder } from 'database/seeds/<%= namePascal %>Seeder' | ||
|
||
@Injectable() | ||
export class <%= namePascal %>Factory extends Factory<any> { | ||
@Inject(<%= namePascal %>Seeder) protected seeder: <%= namePascal %>Seeder | ||
|
||
blueprint = () => { | ||
return { | ||
example: this.faker.name.findName(), | ||
} | ||
} | ||
|
||
fakeBlueprint = () => { | ||
return { | ||
id: this.faker.datatype.uuid(), | ||
name: this.faker.name.findName(), | ||
status: 'pendent', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
} | ||
} | ||
} |
Oops, something went wrong.