-
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
065231e
commit cf7e53f
Showing
125 changed files
with
2,583 additions
and
662 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']) %>/infrastructure/persistence/document/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']) %>/infrastructure/persistence/document/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(); | ||
} | ||
} | ||
} |
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,14 @@ | ||
--- | ||
to: src/database/seeds/relational/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.module.ts | ||
--- | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import { <%= name %>Entity } from 'src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/relational/entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.entity'; | ||
import { <%= name %>SeedService } from './<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.service'; | ||
|
||
@Module({ | ||
imports: [TypeOrmModule.forFeature([<%= name %>Entity])], | ||
providers: [<%= name %>SeedService], | ||
exports: [<%= name %>SeedService], | ||
}) | ||
export class <%= 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,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, |
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,23 @@ | ||
--- | ||
to: src/database/seeds/relational/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.service.ts | ||
--- | ||
import { Injectable } from '@nestjs/common'; | ||
import { InjectRepository } from '@nestjs/typeorm'; | ||
import { <%= name %>Entity } from 'src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/relational/entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.entity'; | ||
import { Repository } from 'typeorm'; | ||
|
||
@Injectable() | ||
export class <%= name %>SeedService { | ||
constructor( | ||
@InjectRepository(<%= name %>Entity) | ||
private repository: Repository<<%= name %>Entity>, | ||
) {} | ||
|
||
async run() { | ||
const count = await this.repository.count(); | ||
|
||
if (count === 0) { | ||
await this.repository.save(this.repository.create({})); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
Oops, something went wrong.