@koalarx/nest-cli 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/code-base/startup-project/package.json +1 -1
- package/code-base/startup-project/src/application/person/create-person-job/create-person-job.ts +3 -3
- package/code-base/startup-project/src/application/person/delete-inative-job/delete-inactive-job.ts +3 -3
- package/code-base/startup-project/src/application/person/events/inactive-person/inactive-person-handler.ts +2 -2
- package/code-base/startup-project/src/application/person/events/person-event.job.ts +2 -2
- package/code-base/startup-project/src/host/app.module.ts +8 -17
- package/code-base/startup-project/src/host/controllers/controller.module.ts +3 -3
- package/code-base/startup-project/src/host/controllers/person/create-person.controller.ts +4 -4
- package/code-base/startup-project/src/host/controllers/person/delete-person.controller.ts +4 -4
- package/code-base/startup-project/src/host/controllers/person/person.module.ts +6 -0
- package/code-base/startup-project/src/host/controllers/person/read-many-person.controller.ts +4 -4
- package/code-base/startup-project/src/host/controllers/person/read-person.controller.ts +4 -4
- package/code-base/startup-project/src/host/controllers/person/update-person.controller.ts +4 -4
- package/code-base/startup-project/src/host/main.ts +5 -1
- package/code-base/startup-project/src/infra/database/repositories/repositories.module.ts +1 -0
- package/code-base/startup-project/src/infra/infra.module.ts +8 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/code-base/startup-project/src/host/controllers/controllers.module.ts +0 -9
package/code-base/startup-project/src/application/person/create-person-job/create-person-job.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IPersonRepository } from '@/domain/repositories/iperson.repository'
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
CronJobHandler,
|
|
4
4
|
CronJobResponse,
|
|
5
|
-
} from '@koalarx/nest/core/backgroud-services/cron-service/cron-job'
|
|
5
|
+
} from '@koalarx/nest/core/backgroud-services/cron-service/cron-job.handler.base'
|
|
6
6
|
import { EventQueue } from '@koalarx/nest/core/backgroud-services/event-service/event-queue'
|
|
7
7
|
import { ok } from '@koalarx/nest/core/request-overflow/request-result'
|
|
8
8
|
import { ILoggingService } from '@koalarx/nest/services/logging/ilogging.service'
|
|
@@ -13,7 +13,7 @@ import { InactivePersonEvent } from '../events/inactive-person/inactive-person-e
|
|
|
13
13
|
import { PersonEventJob } from '../events/person-event.job'
|
|
14
14
|
|
|
15
15
|
@Injectable()
|
|
16
|
-
export class CreatePersonJob extends
|
|
16
|
+
export class CreatePersonJob extends CronJobHandler {
|
|
17
17
|
constructor(
|
|
18
18
|
redlockService: IRedLockService,
|
|
19
19
|
loggingService: ILoggingService,
|
package/code-base/startup-project/src/application/person/delete-inative-job/delete-inactive-job.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReadManyPersonDto } from '@/domain/dtos/read-many-person.dto'
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
CronJobHandler,
|
|
4
4
|
CronJobResponse,
|
|
5
|
-
} from '@koalarx/nest/core/backgroud-services/cron-service/cron-job'
|
|
5
|
+
} from '@koalarx/nest/core/backgroud-services/cron-service/cron-job.handler.base'
|
|
6
6
|
import { ok } from '@koalarx/nest/core/request-overflow/request-result'
|
|
7
7
|
import { ILoggingService } from '@koalarx/nest/services/logging/ilogging.service'
|
|
8
8
|
import { IRedLockService } from '@koalarx/nest/services/redlock/ired-lock.service'
|
|
@@ -11,7 +11,7 @@ import { DeletePersonHandler } from '../delete/delete-person.handler'
|
|
|
11
11
|
import { ReadManyPersonHandler } from '../read-many/read-many-person.handler'
|
|
12
12
|
|
|
13
13
|
@Injectable()
|
|
14
|
-
export class DeleteInactiveJob extends
|
|
14
|
+
export class DeleteInactiveJob extends CronJobHandler {
|
|
15
15
|
constructor(
|
|
16
16
|
redlockService: IRedLockService,
|
|
17
17
|
loggingService: ILoggingService,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReadManyPersonDto } from '@/domain/dtos/read-many-person.dto'
|
|
2
2
|
import { IPersonRepository } from '@/domain/repositories/iperson.repository'
|
|
3
|
-
import {
|
|
3
|
+
import { EventHandlerBase } from '@koalarx/nest/core/backgroud-services/event-service/event-handler.base'
|
|
4
4
|
import { Injectable } from '@nestjs/common'
|
|
5
5
|
import { InactivePersonEvent } from './inactive-person-event'
|
|
6
6
|
|
|
7
7
|
@Injectable()
|
|
8
|
-
export class InactivePersonHandler extends
|
|
8
|
+
export class InactivePersonHandler extends EventHandlerBase<InactivePersonEvent> {
|
|
9
9
|
constructor(private readonly repository: IPersonRepository) {
|
|
10
10
|
super()
|
|
11
11
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Person } from '@/domain/entities/person/person'
|
|
2
|
-
import {
|
|
2
|
+
import { EventHandlerBase } from '@koalarx/nest/core/backgroud-services/event-service/event-handler.base'
|
|
3
3
|
import { EventJob } from '@koalarx/nest/core/backgroud-services/event-service/event-job'
|
|
4
4
|
import { Type } from '@nestjs/common'
|
|
5
5
|
import { InactivePersonHandler } from './inactive-person/inactive-person-handler'
|
|
6
6
|
|
|
7
7
|
export class PersonEventJob extends EventJob<Person> {
|
|
8
|
-
defineHandlers(): Type<
|
|
8
|
+
defineHandlers(): Type<EventHandlerBase<any>>[] {
|
|
9
9
|
return [InactivePersonHandler]
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
import { CreatePersonJob } from '@/application/person/create-person-job/create-person-job'
|
|
2
|
-
import { CreatePersonHandler } from '@/application/person/create/create-person.handler'
|
|
3
2
|
import { DeleteInactiveJob } from '@/application/person/delete-inative-job/delete-inactive-job'
|
|
4
|
-
import { DeletePersonHandler } from '@/application/person/delete/delete-person.handler'
|
|
5
3
|
import { InactivePersonHandler } from '@/application/person/events/inactive-person/inactive-person-handler'
|
|
6
|
-
import {
|
|
7
|
-
import { RepositoriesModule } from '@/infra/database/repositories/repositories.module'
|
|
4
|
+
import { env } from '@/core/env'
|
|
8
5
|
import { KoalaNestModule } from '@koalarx/nest/core/koala-nest.module'
|
|
9
6
|
import { Module } from '@nestjs/common'
|
|
10
|
-
import {
|
|
11
|
-
import { env } from '@/core/env'
|
|
7
|
+
import { PersonModule } from './controllers/person/person.module'
|
|
12
8
|
|
|
13
9
|
@Module({
|
|
14
10
|
imports: [
|
|
15
|
-
KoalaNestModule.register({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
ReadManyPersonHandler,
|
|
22
|
-
DeletePersonHandler,
|
|
23
|
-
DeleteInactiveJob,
|
|
24
|
-
CreatePersonJob,
|
|
25
|
-
InactivePersonHandler,
|
|
11
|
+
KoalaNestModule.register({
|
|
12
|
+
env,
|
|
13
|
+
constrollers: [PersonModule],
|
|
14
|
+
cronJobs: [DeleteInactiveJob, CreatePersonJob],
|
|
15
|
+
eventJobs: [InactivePersonHandler],
|
|
16
|
+
}),
|
|
26
17
|
],
|
|
27
18
|
})
|
|
28
19
|
export class AppModule {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MappingProfile } from '@/application/mapping/mapping.profile'
|
|
2
|
-
import {
|
|
2
|
+
import { InfraModule } from '@/infra/infra.module'
|
|
3
3
|
import { KoalaNestHttpModule } from '@koalarx/nest/core/koala-nest-http.module'
|
|
4
4
|
import { Module } from '@nestjs/common'
|
|
5
5
|
|
|
@@ -9,8 +9,8 @@ import { Module } from '@nestjs/common'
|
|
|
9
9
|
automapperProfile: MappingProfile,
|
|
10
10
|
middlewares: [],
|
|
11
11
|
}),
|
|
12
|
-
|
|
12
|
+
InfraModule,
|
|
13
13
|
],
|
|
14
|
-
exports: [KoalaNestHttpModule,
|
|
14
|
+
exports: [KoalaNestHttpModule, InfraModule],
|
|
15
15
|
})
|
|
16
16
|
export class ControllerModule {}
|
|
@@ -2,12 +2,12 @@ import { CreatePersonHandler } from '@/application/person/create/create-person.h
|
|
|
2
2
|
import { CreatePersonRequest } from '@/application/person/create/create-person.request'
|
|
3
3
|
import { CreatePersonResponse } from '@/application/person/create/create-person.response'
|
|
4
4
|
import { IController } from '@koalarx/nest/core/controllers/base.controller'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Controller } from '@koalarx/nest/core/controllers/controller.decorator'
|
|
6
|
+
import { Body, HttpCode, HttpStatus, Post } from '@nestjs/common'
|
|
7
|
+
import { ApiCreatedResponse } from '@nestjs/swagger'
|
|
7
8
|
import { PERSON_ROUTER_CONFIG } from './router.config'
|
|
8
9
|
|
|
9
|
-
@
|
|
10
|
-
@Controller(PERSON_ROUTER_CONFIG.group)
|
|
10
|
+
@Controller(PERSON_ROUTER_CONFIG)
|
|
11
11
|
export class CreatePersonController
|
|
12
12
|
implements IController<CreatePersonRequest, CreatePersonResponse>
|
|
13
13
|
{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DeletePersonHandler } from '@/application/person/delete/delete-person.handler'
|
|
2
2
|
import { IController } from '@koalarx/nest/core/controllers/base.controller'
|
|
3
|
-
import { Controller
|
|
4
|
-
import {
|
|
3
|
+
import { Controller } from '@koalarx/nest/core/controllers/controller.decorator'
|
|
4
|
+
import { Delete, HttpCode, HttpStatus, Param } from '@nestjs/common'
|
|
5
|
+
import { ApiNoContentResponse } from '@nestjs/swagger'
|
|
5
6
|
import { PERSON_ROUTER_CONFIG } from './router.config'
|
|
6
7
|
|
|
7
|
-
@
|
|
8
|
-
@Controller(PERSON_ROUTER_CONFIG.group)
|
|
8
|
+
@Controller(PERSON_ROUTER_CONFIG)
|
|
9
9
|
export class DeletePersonController implements IController<null, void, string> {
|
|
10
10
|
constructor(private readonly handler: DeletePersonHandler) {}
|
|
11
11
|
|
|
@@ -27,5 +27,11 @@ import { UpdatePersonController } from './update-person.controller'
|
|
|
27
27
|
UpdatePersonHandler,
|
|
28
28
|
DeletePersonHandler,
|
|
29
29
|
],
|
|
30
|
+
exports: [
|
|
31
|
+
ControllerModule,
|
|
32
|
+
CreatePersonHandler,
|
|
33
|
+
ReadManyPersonHandler,
|
|
34
|
+
DeletePersonHandler,
|
|
35
|
+
],
|
|
30
36
|
})
|
|
31
37
|
export class PersonModule {}
|
package/code-base/startup-project/src/host/controllers/person/read-many-person.controller.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { ReadManyPersonHandler } from '@/application/person/read-many/read-many-
|
|
|
2
2
|
import { ReadManyPersonRequest } from '@/application/person/read-many/read-many-person.request'
|
|
3
3
|
import { ReadManyPersonResponse } from '@/application/person/read-many/read-many-person.response'
|
|
4
4
|
import { IController } from '@koalarx/nest/core/controllers/base.controller'
|
|
5
|
-
import { Controller
|
|
6
|
-
import {
|
|
5
|
+
import { Controller } from '@koalarx/nest/core/controllers/controller.decorator'
|
|
6
|
+
import { Get, Query } from '@nestjs/common'
|
|
7
|
+
import { ApiOkResponse } from '@nestjs/swagger'
|
|
7
8
|
import { PERSON_ROUTER_CONFIG } from './router.config'
|
|
8
9
|
|
|
9
|
-
@
|
|
10
|
-
@Controller(PERSON_ROUTER_CONFIG.group)
|
|
10
|
+
@Controller(PERSON_ROUTER_CONFIG)
|
|
11
11
|
export class ReadManyPersonController
|
|
12
12
|
implements IController<ReadManyPersonRequest, ReadManyPersonResponse>
|
|
13
13
|
{
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ReadPersonHandler } from '@/application/person/read/read-person.handler'
|
|
2
2
|
import { ReadPersonResponse } from '@/application/person/read/read-person.response'
|
|
3
3
|
import { IController } from '@koalarx/nest/core/controllers/base.controller'
|
|
4
|
-
import { Controller
|
|
5
|
-
import {
|
|
4
|
+
import { Controller } from '@koalarx/nest/core/controllers/controller.decorator'
|
|
5
|
+
import { Get, Param } from '@nestjs/common'
|
|
6
|
+
import { ApiOkResponse } from '@nestjs/swagger'
|
|
6
7
|
import { PERSON_ROUTER_CONFIG } from './router.config'
|
|
7
8
|
|
|
8
|
-
@
|
|
9
|
-
@Controller(PERSON_ROUTER_CONFIG.group)
|
|
9
|
+
@Controller(PERSON_ROUTER_CONFIG)
|
|
10
10
|
export class ReadPersonController
|
|
11
11
|
implements IController<null, ReadPersonResponse, string>
|
|
12
12
|
{
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { UpdatePersonHandler } from '@/application/person/update/update-person.handler'
|
|
2
2
|
import { UpdatePersonRequest } from '@/application/person/update/update-person.request'
|
|
3
3
|
import { IController } from '@koalarx/nest/core/controllers/base.controller'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Controller } from '@koalarx/nest/core/controllers/controller.decorator'
|
|
5
|
+
import { Body, Param, Put } from '@nestjs/common'
|
|
6
|
+
import { ApiOkResponse } from '@nestjs/swagger'
|
|
6
7
|
import { PERSON_ROUTER_CONFIG } from './router.config'
|
|
7
8
|
|
|
8
|
-
@
|
|
9
|
-
@Controller(PERSON_ROUTER_CONFIG.group)
|
|
9
|
+
@Controller(PERSON_ROUTER_CONFIG)
|
|
10
10
|
export class UpdatePersonController
|
|
11
11
|
implements IController<UpdatePersonRequest, void>
|
|
12
12
|
{
|
|
@@ -5,6 +5,7 @@ import { DbTransactionContext } from '@/infra/database/db-transaction-context'
|
|
|
5
5
|
import { KoalaApp } from '@koalarx/nest/core/koala-app'
|
|
6
6
|
import { NestFactory } from '@nestjs/core'
|
|
7
7
|
import { AppModule } from './app.module'
|
|
8
|
+
import { EnvService } from '@koalarx/nest/env/env.service'
|
|
8
9
|
|
|
9
10
|
async function bootstrap() {
|
|
10
11
|
const app = await NestFactory.create(AppModule).then((app) =>
|
|
@@ -25,6 +26,9 @@ async function bootstrap() {
|
|
|
25
26
|
.build(),
|
|
26
27
|
)
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
const envService = app.get(EnvService)
|
|
30
|
+
const port = envService.get('PORT') ?? 3000
|
|
31
|
+
|
|
32
|
+
await app.listen(port)
|
|
29
33
|
}
|
|
30
34
|
bootstrap()
|
package/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var import_inquirer = __toESM(require("inquirer"));
|
|
|
30
30
|
// package.json
|
|
31
31
|
var package_default = {
|
|
32
32
|
name: "@koalarx/nest-cli",
|
|
33
|
-
version: "1.0.
|
|
33
|
+
version: "1.0.19",
|
|
34
34
|
description: "Biblioteca de CLI para cria\xE7\xE3o de projetos utilizando Koala Nest",
|
|
35
35
|
scripts: {
|
|
36
36
|
test: "vitest run",
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common'
|
|
2
|
-
import { ControllerModule } from './controller.module'
|
|
3
|
-
import { PersonModule } from './person/person.module'
|
|
4
|
-
|
|
5
|
-
@Module({
|
|
6
|
-
imports: [ControllerModule, PersonModule],
|
|
7
|
-
exports: [ControllerModule],
|
|
8
|
-
})
|
|
9
|
-
export class ControllersModule {}
|