@koalarx/nest-cli 1.0.12 → 1.0.14
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/nest-cli.json +1 -1
- package/code-base/startup-project/package.json +2 -2
- package/code-base/startup-project/src/application/mapping/person.mapping.ts +28 -0
- package/code-base/startup-project/src/application/person/create/create-person.handler.ts +1 -1
- package/code-base/startup-project/src/application/person/delete-inative-job/delete-inactive-job.ts +2 -2
- package/code-base/startup-project/src/application/person/events/inactive-person/inactive-person-handler.ts +2 -1
- package/code-base/startup-project/src/application/person/read-many/read-many-person.handler.spec.ts +2 -2
- package/code-base/startup-project/src/application/person/read-many/read-many-person.handler.ts +6 -1
- package/code-base/startup-project/src/application/person/read-many/read-many-person.request.ts +6 -3
- package/code-base/startup-project/src/application/person/read-many/read-many-person.response.ts +1 -1
- package/code-base/startup-project/src/application/person/update/update-person.handler.ts +1 -1
- package/code-base/startup-project/src/core/.gitkeep +0 -0
- package/code-base/startup-project/src/domain/dtos/read-many-person.dto.ts +16 -0
- package/code-base/startup-project/src/domain/repositories/iperson.repository.ts +4 -6
- package/code-base/startup-project/src/domain/services/.gitkeep +0 -0
- package/code-base/startup-project/src/{infra → host}/app.module.ts +1 -1
- package/code-base/startup-project/src/{infra → host}/controllers/controller.module.ts +2 -2
- package/code-base/startup-project/src/{infra → host}/main.ts +1 -1
- package/code-base/startup-project/src/infra/database/repositories/person.repository.ts +9 -5
- package/code-base/startup-project/src/infra/services/.gitkeep +0 -0
- package/code-base/startup-project/src/test/create-e2e-test-app.ts +1 -1
- package/code-base/startup-project/src/test/create-unit-test-app.ts +1 -1
- package/code-base/startup-project/src/test/repositories/person.repository.ts +10 -6
- package/index.js +1 -1
- package/package.json +1 -1
- package/code-base/startup-project/src/domain/mapping/person.mapping.ts +0 -24
- /package/code-base/startup-project/src/{domain → application}/mapping/mapping.profile.ts +0 -0
- /package/code-base/startup-project/src/{infra → host}/controllers/controllers.module.ts +0 -0
- /package/code-base/startup-project/src/{infra → host}/controllers/person/create-person.controller.ts +0 -0
- /package/code-base/startup-project/src/{infra → host}/controllers/person/delete-person.controller.ts +0 -0
- /package/code-base/startup-project/src/{infra → host}/controllers/person/person.controller.e2e-spec.ts +0 -0
- /package/code-base/startup-project/src/{infra → host}/controllers/person/person.module.ts +0 -0
- /package/code-base/startup-project/src/{infra → host}/controllers/person/read-many-person.controller.ts +0 -0
- /package/code-base/startup-project/src/{infra → host}/controllers/person/read-person.controller.ts +0 -0
- /package/code-base/startup-project/src/{infra → host}/controllers/person/router.config.ts +0 -0
- /package/code-base/startup-project/src/{infra → host}/controllers/person/update-person.controller.ts +0 -0
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"start": "nest start",
|
|
12
12
|
"start:dev": "npm run swc:copy-files && nest start --watch",
|
|
13
13
|
"start:debug": "npm run swc:copy-files && nest start --debug --watch",
|
|
14
|
-
"start:prod": "node dist/
|
|
14
|
+
"start:prod": "node dist/host/main",
|
|
15
15
|
"lint": "prettier --end-of-line lf --write . && npx eslint --fix src/**/* && npx eslint --fix .eslintrc.js",
|
|
16
16
|
"test": "vitest run",
|
|
17
17
|
"test:watch": "vitest",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@koalarx/utils": "3.1.3",
|
|
25
|
-
"@koalarx/nest": "^1.0
|
|
25
|
+
"@koalarx/nest": "^1.1.0",
|
|
26
26
|
"@nestjs/common": "11.0.12",
|
|
27
27
|
"@nestjs/config": "4.0.1",
|
|
28
28
|
"@nestjs/core": "11.0.12",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReadManyPersonDto } from "@/domain/dtos/read-many-person.dto"
|
|
2
|
+
import { Person } from "@/domain/entities/person/person"
|
|
3
|
+
import { PersonPhone } from "@/domain/entities/person/person-phone"
|
|
4
|
+
import { createMap } from "@koalarx/nest/core/mapping/create-map"
|
|
5
|
+
import { forMember } from "@koalarx/nest/core/mapping/for-member"
|
|
6
|
+
import { CreatePersonPhoneRequest, CreatePersonRequest } from "../person/create/create-person.request"
|
|
7
|
+
import { ReadManyPersonRequest } from "../person/read-many/read-many-person.request"
|
|
8
|
+
import { ReadPersonPhoneResponse, ReadPersonResponse } from "../person/read/read-person.response"
|
|
9
|
+
import { UpdatePersonPhoneRequest, UpdatePersonRequest } from "../person/update/update-person.request"
|
|
10
|
+
|
|
11
|
+
export class PersonMapping {
|
|
12
|
+
static createMap() {
|
|
13
|
+
createMap(CreatePersonPhoneRequest, PersonPhone)
|
|
14
|
+
createMap(CreatePersonRequest, Person)
|
|
15
|
+
|
|
16
|
+
createMap(PersonPhone, ReadPersonPhoneResponse)
|
|
17
|
+
createMap(
|
|
18
|
+
Person,
|
|
19
|
+
ReadPersonResponse,
|
|
20
|
+
forMember('status', (s) => (s.active === true ? 'active' : 'inactive')),
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
createMap(ReadManyPersonRequest, ReadManyPersonDto)
|
|
24
|
+
|
|
25
|
+
createMap(UpdatePersonPhoneRequest, PersonPhone)
|
|
26
|
+
createMap(UpdatePersonRequest, Person)
|
|
27
|
+
}
|
|
28
|
+
}
|
package/code-base/startup-project/src/application/person/delete-inative-job/delete-inactive-job.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReadManyPersonDto } from '@/domain/dtos/read-many-person.dto'
|
|
1
2
|
import {
|
|
2
3
|
CronJob,
|
|
3
4
|
CronJobResponse,
|
|
@@ -8,7 +9,6 @@ import { IRedLockService } from '@koalarx/nest/services/redlock/ired-lock.servic
|
|
|
8
9
|
import { Injectable } from '@nestjs/common'
|
|
9
10
|
import { DeletePersonHandler } from '../delete/delete-person.handler'
|
|
10
11
|
import { ReadManyPersonHandler } from '../read-many/read-many-person.handler'
|
|
11
|
-
import { ReadManyPersonRequest } from '../read-many/read-many-person.request'
|
|
12
12
|
|
|
13
13
|
@Injectable()
|
|
14
14
|
export class DeleteInactiveJob extends CronJob {
|
|
@@ -23,7 +23,7 @@ export class DeleteInactiveJob extends CronJob {
|
|
|
23
23
|
|
|
24
24
|
protected async run(): Promise<CronJobResponse> {
|
|
25
25
|
const result = await this.readManyPerson.handle(
|
|
26
|
-
new
|
|
26
|
+
new ReadManyPersonDto({ active: false }),
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
if (result.isOk()) {
|
|
@@ -3,6 +3,7 @@ import { EventHandler } from '@koalarx/nest/core/backgroud-services/event-servic
|
|
|
3
3
|
import { Injectable } from '@nestjs/common'
|
|
4
4
|
import { ReadManyPersonRequest } from '../../read-many/read-many-person.request'
|
|
5
5
|
import { InactivePersonEvent } from './inactive-person-event'
|
|
6
|
+
import { ReadManyPersonDto } from '@/domain/dtos/read-many-person.dto'
|
|
6
7
|
|
|
7
8
|
@Injectable()
|
|
8
9
|
export class InactivePersonHandler extends EventHandler<InactivePersonEvent> {
|
|
@@ -12,7 +13,7 @@ export class InactivePersonHandler extends EventHandler<InactivePersonEvent> {
|
|
|
12
13
|
|
|
13
14
|
async handleEvent(): Promise<void> {
|
|
14
15
|
const result = await this.repository.readMany(
|
|
15
|
-
new
|
|
16
|
+
new ReadManyPersonDto({ active: true }),
|
|
16
17
|
)
|
|
17
18
|
|
|
18
19
|
for (const person of result.items) {
|
package/code-base/startup-project/src/application/person/read-many/read-many-person.handler.spec.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createUnitTestApp } from "@/test/create-unit-test-app"
|
|
2
2
|
import { createPersonRequestMockup } from "@/test/mockup/person/create-person-request.mockup"
|
|
3
|
+
import { RequestResult } from "@koalarx/nest/core/request-overflow/request-result"
|
|
3
4
|
import { CreatePersonHandler } from "../create/create-person.handler"
|
|
5
|
+
import { CreatePersonResponse } from "../create/create-person.response"
|
|
4
6
|
import { ReadManyPersonHandler } from "./read-many-person.handler"
|
|
5
7
|
import { ReadManyPersonRequest } from "./read-many-person.request"
|
|
6
|
-
import { RequestResult } from "@koalarx/nest/core/request-overflow/request-result"
|
|
7
|
-
import { CreatePersonResponse } from "../create/create-person.response"
|
|
8
8
|
|
|
9
9
|
describe('ReadManyPersonHandler', () => {
|
|
10
10
|
const app = createUnitTestApp()
|
package/code-base/startup-project/src/application/person/read-many/read-many-person.handler.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReadManyPersonDto } from '@/domain/dtos/read-many-person.dto'
|
|
1
2
|
import { Person } from '@/domain/entities/person/person'
|
|
2
3
|
import { IPersonRepository } from '@/domain/repositories/iperson.repository'
|
|
3
4
|
import { ResourceNotFoundError } from '@koalarx/nest/core/errors/resource-not-found.error'
|
|
@@ -29,7 +30,11 @@ export class ReadManyPersonHandler extends RequestHandlerBase<
|
|
|
29
30
|
query: ReadManyPersonRequest,
|
|
30
31
|
): Promise<RequestResult<ResourceNotFoundError, ReadManyPersonResponse>> {
|
|
31
32
|
const listOfPerson = await this.repository.readMany(
|
|
32
|
-
|
|
33
|
+
this.mapper.map(
|
|
34
|
+
new ReadManyPersonValidator(query).validate(),
|
|
35
|
+
ReadManyPersonRequest,
|
|
36
|
+
ReadManyPersonDto
|
|
37
|
+
),
|
|
33
38
|
)
|
|
34
39
|
|
|
35
40
|
return ok({
|
package/code-base/startup-project/src/application/person/read-many/read-many-person.request.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { PaginatedRequestProps,
|
|
1
|
+
import { PaginatedRequestProps, PaginationRequest } from '@koalarx/nest/core/controllers/pagination.request'
|
|
2
|
+
import { AutoMap } from '@koalarx/nest/core/mapping/auto-mapping.decorator'
|
|
2
3
|
import { ApiProperty } from '@nestjs/swagger'
|
|
3
4
|
|
|
4
|
-
export class ReadManyPersonRequest extends
|
|
5
|
+
export class ReadManyPersonRequest extends PaginationRequest {
|
|
5
6
|
@ApiProperty({ required: false })
|
|
7
|
+
@AutoMap()
|
|
6
8
|
name?: string
|
|
7
9
|
|
|
8
10
|
@ApiProperty({ required: false })
|
|
11
|
+
@AutoMap()
|
|
9
12
|
active?: boolean
|
|
10
|
-
|
|
13
|
+
|
|
11
14
|
constructor(props?: PaginatedRequestProps<ReadManyPersonRequest>) {
|
|
12
15
|
super()
|
|
13
16
|
Object.assign(this, props)
|
package/code-base/startup-project/src/application/person/read-many/read-many-person.response.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListResponse } from '@koalarx/nest/core
|
|
1
|
+
import { ListResponse } from '@koalarx/nest/core'
|
|
2
2
|
import { AutoMap } from '@koalarx/nest/core/mapping/auto-mapping.decorator'
|
|
3
3
|
import { ApiProperty } from '@nestjs/swagger'
|
|
4
4
|
import { ReadPersonResponse } from '../read/read-person.response'
|
|
@@ -49,7 +49,7 @@ export class UpdatePersonHandler extends RequestHandlerBase<
|
|
|
49
49
|
personInBd.active = person.active
|
|
50
50
|
personInBd.phones.update(person.phones.toArray())
|
|
51
51
|
|
|
52
|
-
await this.repository.
|
|
52
|
+
await this.repository.update(personInBd)
|
|
53
53
|
|
|
54
54
|
return ok(null)
|
|
55
55
|
}
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PaginatedRequestProps } from '@koalarx/nest/core/controllers/pagination.request'
|
|
2
|
+
import { PaginationDto } from '@koalarx/nest/core/dtos/pagination.dto'
|
|
3
|
+
import { AutoMap } from '@koalarx/nest/core/mapping/auto-mapping.decorator'
|
|
4
|
+
|
|
5
|
+
export class ReadManyPersonDto extends PaginationDto {
|
|
6
|
+
@AutoMap()
|
|
7
|
+
name?: string
|
|
8
|
+
|
|
9
|
+
@AutoMap()
|
|
10
|
+
active?: boolean
|
|
11
|
+
|
|
12
|
+
constructor(props?: PaginatedRequestProps<ReadManyPersonDto>) {
|
|
13
|
+
super()
|
|
14
|
+
Object.assign(this, props)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { CreatedRegistreResponseBase } from '@koalarx/nest/core/controllers/created-registre-response.base'
|
|
2
2
|
import { ListResponseBase } from '@koalarx/nest/core/controllers/list-response.base'
|
|
3
|
+
import { ReadManyPersonDto } from '../dtos/read-many-person.dto'
|
|
3
4
|
import { Person } from '../entities/person/person'
|
|
4
|
-
import { ReadManyPersonRequest } from '@/application/person/read-many/read-many-person.request'
|
|
5
5
|
|
|
6
6
|
export abstract class IPersonRepository {
|
|
7
|
-
abstract
|
|
7
|
+
abstract create(person: Person): Promise<CreatedRegistreResponseBase<number>>
|
|
8
|
+
abstract update(person: Person): Promise<void>
|
|
8
9
|
abstract read(id: number): Promise<Person | null>
|
|
9
|
-
abstract readMany(
|
|
10
|
-
query: ReadManyPersonRequest,
|
|
11
|
-
): Promise<ListResponseBase<Person>>
|
|
12
|
-
|
|
10
|
+
abstract readMany(query: ReadManyPersonDto): Promise<ListResponseBase<Person>>
|
|
13
11
|
abstract delete(id: number): Promise<void>
|
|
14
12
|
}
|
|
File without changes
|
|
@@ -4,10 +4,10 @@ import { DeleteInactiveJob } from '@/application/person/delete-inative-job/delet
|
|
|
4
4
|
import { DeletePersonHandler } from '@/application/person/delete/delete-person.handler'
|
|
5
5
|
import { InactivePersonHandler } from '@/application/person/events/inactive-person/inactive-person-handler'
|
|
6
6
|
import { ReadManyPersonHandler } from '@/application/person/read-many/read-many-person.handler'
|
|
7
|
+
import { RepositoriesModule } from '@/infra/database/repositories/repositories.module'
|
|
7
8
|
import { KoalaNestModule } from '@koalarx/nest/core/koala-nest.module'
|
|
8
9
|
import { Module } from '@nestjs/common'
|
|
9
10
|
import { ControllersModule } from './controllers/controllers.module'
|
|
10
|
-
import { RepositoriesModule } from './database/repositories/repositories.module'
|
|
11
11
|
|
|
12
12
|
@Module({
|
|
13
13
|
imports: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MappingProfile } from '@/
|
|
1
|
+
import { MappingProfile } from '@/application/mapping/mapping.profile'
|
|
2
|
+
import { RepositoriesModule } from '@/infra/database/repositories/repositories.module'
|
|
2
3
|
import { KoalaNestHttpModule } from '@koalarx/nest/core/koala-nest-http.module'
|
|
3
4
|
import { Module } from '@nestjs/common'
|
|
4
|
-
import { RepositoriesModule } from '../database/repositories/repositories.module'
|
|
5
5
|
|
|
6
6
|
@Module({
|
|
7
7
|
imports: [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CreatePersonJob } from '@/application/person/create-person-job/create-person-job'
|
|
2
2
|
import { DeleteInactiveJob } from '@/application/person/delete-inative-job/delete-inactive-job'
|
|
3
3
|
import { InactivePersonHandler } from '@/application/person/events/inactive-person/inactive-person-handler'
|
|
4
|
+
import { DbTransactionContext } from '@/infra/database/db-transaction-context'
|
|
4
5
|
import { KoalaApp } from '@koalarx/nest/core/koala-app'
|
|
5
6
|
import { NestFactory } from '@nestjs/core'
|
|
6
7
|
import { AppModule } from './app.module'
|
|
7
|
-
import { DbTransactionContext } from './database/db-transaction-context'
|
|
8
8
|
|
|
9
9
|
async function bootstrap() {
|
|
10
10
|
const app = await NestFactory.create(AppModule).then((app) =>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReadManyPersonDto } from '@/domain/dtos/read-many-person.dto'
|
|
2
2
|
import { Person } from '@/domain/entities/person/person'
|
|
3
3
|
import { IPersonRepository } from '@/domain/repositories/iperson.repository'
|
|
4
4
|
import { CreatedRegistreResponseBase } from '@koalarx/nest/core/controllers/created-registre-response.base'
|
|
@@ -25,15 +25,19 @@ export class PersonRepository
|
|
|
25
25
|
})
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
return this.
|
|
28
|
+
create(person: Person): Promise<CreatedRegistreResponseBase<number>> {
|
|
29
|
+
return this.insert(person)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
update(person: Person): Promise<void> {
|
|
33
|
+
return this.edit(person)
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
read(id: number): Promise<Person | null> {
|
|
33
37
|
return this.findById(id)
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
readMany(query:
|
|
40
|
+
readMany(query: ReadManyPersonDto): Promise<ListResponseBase<Person>> {
|
|
37
41
|
return this.findManyAndCount<Prisma.PersonWhereInput>(
|
|
38
42
|
{
|
|
39
43
|
name: {
|
|
@@ -46,6 +50,6 @@ export class PersonRepository
|
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
delete(id: number): Promise<void> {
|
|
49
|
-
return
|
|
53
|
+
return this.remove<Prisma.PersonWhereUniqueInput>({ id })
|
|
50
54
|
}
|
|
51
55
|
}
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppModule } from '@/
|
|
1
|
+
import { AppModule } from '@/host/app.module'
|
|
2
2
|
import { DbTransactionContext } from '@/infra/database/db-transaction-context'
|
|
3
3
|
import { KoalaAppTest } from '@koalarx/nest/test/koala-app-test'
|
|
4
4
|
import { Test } from '@nestjs/testing'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CreatePersonHandler } from '@/application/person/create/create-person.handler'
|
|
2
|
-
import { MappingProfile } from '@/
|
|
2
|
+
import { MappingProfile } from '@/application/mapping/mapping.profile'
|
|
3
3
|
import { AutoMappingService } from '@koalarx/nest/core/mapping/auto-mapping.service'
|
|
4
4
|
import { KoalaAppTestDependencies } from '@koalarx/nest/test/koala-app-test-dependencies'
|
|
5
5
|
import { PersonRepository } from './repositories/person.repository'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReadManyPersonDto } from "@/domain/dtos/read-many-person.dto";
|
|
2
2
|
import { Person } from "@/domain/entities/person/person";
|
|
3
3
|
import { IPersonRepository } from "@/domain/repositories/iperson.repository";
|
|
4
4
|
import { CreatedRegistreResponseBase } from "@koalarx/nest/core/controllers/created-registre-response.base";
|
|
@@ -6,22 +6,26 @@ import { ListResponseBase } from "@koalarx/nest/core/controllers/list-response.b
|
|
|
6
6
|
import { InMemoryBaseRepository } from "@koalarx/nest/test/repositories/in-memory-base.repository";
|
|
7
7
|
|
|
8
8
|
export class PersonRepository extends InMemoryBaseRepository<Person> implements IPersonRepository {
|
|
9
|
-
|
|
10
|
-
return this.
|
|
9
|
+
create(person: Person): Promise<CreatedRegistreResponseBase<number>> {
|
|
10
|
+
return this.insert(person)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
update(person: Person): Promise<void> {
|
|
14
|
+
return this.edit(person, (item) => item.id === person.id)
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
read(id: number): Promise<Person | null> {
|
|
14
18
|
return this.findById(id)
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
readMany(query:
|
|
18
|
-
return this.findManyAndCount<
|
|
21
|
+
readMany(query: ReadManyPersonDto): Promise<ListResponseBase<Person>> {
|
|
22
|
+
return this.findManyAndCount<ReadManyPersonDto>(query, (person) =>
|
|
19
23
|
(!query.name || person.name.includes(query.name)) &&
|
|
20
24
|
(query.active === undefined || person.active === query.active)
|
|
21
25
|
)
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
delete(id: number): Promise<void> {
|
|
25
|
-
return
|
|
29
|
+
return this.remove((person) => person.id === id)
|
|
26
30
|
}
|
|
27
31
|
}
|
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.14",
|
|
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,24 +0,0 @@
|
|
|
1
|
-
import { CreatePersonPhoneRequest, CreatePersonRequest } from '@/application/person/create/create-person.request'
|
|
2
|
-
import { ReadPersonPhoneResponse, ReadPersonResponse } from '@/application/person/read/read-person.response'
|
|
3
|
-
import { UpdatePersonPhoneRequest, UpdatePersonRequest } from '@/application/person/update/update-person.request'
|
|
4
|
-
import { createMap } from '@koalarx/nest/core/mapping/create-map'
|
|
5
|
-
import { forMember } from '@koalarx/nest/core/mapping/for-member'
|
|
6
|
-
import { Person } from '../entities/person/person'
|
|
7
|
-
import { PersonPhone } from '../entities/person/person-phone'
|
|
8
|
-
|
|
9
|
-
export class PersonMapping {
|
|
10
|
-
static createMap() {
|
|
11
|
-
createMap(CreatePersonPhoneRequest, PersonPhone)
|
|
12
|
-
createMap(CreatePersonRequest, Person)
|
|
13
|
-
|
|
14
|
-
createMap(PersonPhone, ReadPersonPhoneResponse)
|
|
15
|
-
createMap(
|
|
16
|
-
Person,
|
|
17
|
-
ReadPersonResponse,
|
|
18
|
-
forMember('status', (s) => (s.active === true ? 'active' : 'inactive')),
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
createMap(UpdatePersonPhoneRequest, PersonPhone)
|
|
22
|
-
createMap(UpdatePersonRequest, Person)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
File without changes
|
|
File without changes
|
/package/code-base/startup-project/src/{infra → host}/controllers/person/create-person.controller.ts
RENAMED
|
File without changes
|
/package/code-base/startup-project/src/{infra → host}/controllers/person/delete-person.controller.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/code-base/startup-project/src/{infra → host}/controllers/person/read-person.controller.ts
RENAMED
|
File without changes
|
|
File without changes
|
/package/code-base/startup-project/src/{infra → host}/controllers/person/update-person.controller.ts
RENAMED
|
File without changes
|