-
Notifications
You must be signed in to change notification settings - Fork 715
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5384b6a
commit f883632
Showing
104 changed files
with
2,226 additions
and
580 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
to: src/database/seeds/document/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.module.ts | ||
--- | ||
import { Module } from '@nestjs/common'; | ||
import { MongooseModule } from '@nestjs/mongoose'; | ||
import { <%= name %>Schema, <%= name %>SchemaClass } from 'src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema'; | ||
import { <%= name %>SeedService } from './<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.service'; | ||
|
||
@Module({ | ||
imports: [ | ||
MongooseModule.forFeature([ | ||
{ | ||
name: <%= name %>SchemaClass.name, | ||
schema: <%= name %>Schema, | ||
}, | ||
]), | ||
], | ||
providers: [<%= name %>SeedService], | ||
exports: [<%= name %>SeedService], | ||
}) | ||
export class <%= name %>SeedModule {} |
2 changes: 1 addition & 1 deletion
2
.hygen/seeds/create/run-seed-import.ejs.t → ...eds/create-document/run-seed-import.ejs.t
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
inject: true | ||
to: src/database/seeds/run-seed.ts | ||
to: src/database/seeds/document/run-seed.ts | ||
after: \@nestjs\/core | ||
--- | ||
import { <%= name %>SeedService } from './<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.service'; |
2 changes: 1 addition & 1 deletion
2
.hygen/seeds/create/run-seed-service.ejs.t → ...ds/create-document/run-seed-service.ejs.t
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
inject: true | ||
to: src/database/seeds/run-seed.ts | ||
to: src/database/seeds/document/run-seed.ts | ||
before: close | ||
--- | ||
await app.get(<%= name %>SeedService).run(); |
2 changes: 1 addition & 1 deletion
2
.hygen/seeds/create/seed-module-import.ejs.t → .../create-document/seed-module-import.ejs.t
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
inject: true | ||
to: src/database/seeds/seed.module.ts | ||
to: src/database/seeds/document/seed.module.ts | ||
before: \@Module | ||
--- | ||
import { <%= name %>SeedModule } from './<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.module'; |
2 changes: 1 addition & 1 deletion
2
.hygen/seeds/create/seed-module.ejs.t → ...n/seeds/create-document/seed-module.ejs.t
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
inject: true | ||
to: src/database/seeds/seed.module.ts | ||
to: src/database/seeds/document/seed.module.ts | ||
after: imports | ||
--- | ||
<%= name %>SeedModule, |
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,24 @@ | ||
--- | ||
to: src/database/seeds/document/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.service.ts | ||
--- | ||
import { Injectable } from '@nestjs/common'; | ||
import { InjectModel } from '@nestjs/mongoose'; | ||
import { Model } from 'mongoose'; | ||
import { <%= name %>SchemaClass } from 'src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema'; | ||
|
||
@Injectable() | ||
export class <%= name %>SeedService { | ||
constructor( | ||
@InjectModel(<%= name %>SchemaClass.name) | ||
private readonly model: Model<<%= name %>SchemaClass>, | ||
) {} | ||
|
||
async run() { | ||
const count = await this.model.countDocuments(); | ||
|
||
if (count === 0) { | ||
const data = new this.model({}); | ||
await data.save(); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.hygen/seeds/create/module.ejs.t → .hygen/seeds/create-relational/module.ejs.t
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,6 @@ | ||
--- | ||
inject: true | ||
to: src/database/seeds/relational/run-seed.ts | ||
after: \@nestjs\/core | ||
--- | ||
import { <%= name %>SeedService } from './<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.service'; |
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,6 @@ | ||
--- | ||
inject: true | ||
to: src/database/seeds/relational/run-seed.ts | ||
before: close | ||
--- | ||
await app.get(<%= name %>SeedService).run(); |
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,6 @@ | ||
--- | ||
inject: true | ||
to: src/database/seeds/relational/seed.module.ts | ||
before: \@Module | ||
--- | ||
import { <%= name %>SeedModule } from './<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.module'; |
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,6 @@ | ||
--- | ||
inject: true | ||
to: src/database/seeds/relational/seed.module.ts | ||
after: imports | ||
--- | ||
<%= name %>SeedModule, |
2 changes: 1 addition & 1 deletion
2
.hygen/seeds/create/service.ejs.t → .hygen/seeds/create-relational/service.ejs.t
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
web: npm run start:prod | ||
release: echo '' > .env && npm run migration:run && npm run seed:run | ||
release: echo '' > .env && npm run migration:run && npm run seed:run:relational |
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,28 @@ | ||
services: | ||
mongo: | ||
image: mongo:7.0.3 | ||
restart: always | ||
environment: | ||
MONGO_INITDB_ROOT_USERNAME: ${DATABASE_USERNAME} | ||
MONGO_INITDB_ROOT_PASSWORD: ${DATABASE_PASSWORD} | ||
expose: | ||
- 27017 | ||
|
||
maildev: | ||
build: | ||
context: . | ||
dockerfile: maildev.Dockerfile | ||
expose: | ||
- 1080 | ||
- 1025 | ||
|
||
# Uncomment to use redis | ||
# redis: | ||
# image: redis:7-alpine | ||
# expose: | ||
# - 6379 | ||
|
||
api: | ||
build: | ||
context: . | ||
dockerfile: document.e2e.Dockerfile |
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,45 @@ | ||
services: | ||
maildev: | ||
build: | ||
context: . | ||
dockerfile: maildev.Dockerfile | ||
ports: | ||
- ${MAIL_CLIENT_PORT}:1080 | ||
- ${MAIL_PORT}:1025 | ||
|
||
mongo: | ||
image: mongo:7.0.3 | ||
restart: always | ||
environment: | ||
MONGO_INITDB_ROOT_USERNAME: ${DATABASE_USERNAME} | ||
MONGO_INITDB_ROOT_PASSWORD: ${DATABASE_PASSWORD} | ||
volumes: | ||
- boilerplate-mongo-db:/data/db | ||
ports: | ||
- 27017:27017 | ||
|
||
mongo-express: | ||
image: mongo-express | ||
restart: always | ||
ports: | ||
- 8081:8081 | ||
environment: | ||
ME_CONFIG_BASICAUTH_USERNAME: ${DATABASE_USERNAME} | ||
ME_CONFIG_BASICAUTH_PASSWORD: ${DATABASE_PASSWORD} | ||
ME_CONFIG_MONGODB_URL: mongodb://${DATABASE_USERNAME}:${DATABASE_PASSWORD}@mongo:27017/ | ||
|
||
# Uncomment to use redis | ||
# redis: | ||
# image: redis:7-alpine | ||
# ports: | ||
# - 6379:6379 | ||
|
||
api: | ||
build: | ||
context: . | ||
dockerfile: document.Dockerfile | ||
ports: | ||
- ${APP_PORT}:${APP_PORT} | ||
|
||
volumes: | ||
boilerplate-mongo-db: |
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
Oops, something went wrong.