From bb04d00cdc4192b249e2ff2882bdbd863ab862b8 Mon Sep 17 00:00:00 2001 From: "Gabriel R. Antunes" Date: Mon, 29 Apr 2024 23:28:10 -0400 Subject: [PATCH] refactor: arquivo.operations from @sisgea/spec --- package-lock.json | 237 +++++++++++++++++- package.json | 2 +- .../hbs/core-module/controller.ts.hbs | 2 +- .../hbs/core-module/service.ts.hbs | 2 +- .../ambientes/ambiente/ambiente.controller.ts | 2 +- .../ambientes/ambiente/ambiente.resolver.ts | 2 +- .../ambientes/ambiente/ambiente.service.ts | 2 +- .../dtos/ambiente-create.operation.ts | 2 +- .../dtos/ambiente-find-one.operation.ts | 2 +- .../dtos/ambiente-update.operation.ts | 2 +- .../ambientes/ambiente/dtos/ambiente.dto.ts | 2 +- .../ambientes/bloco/bloco.controller.ts | 2 +- .../ambientes/bloco/bloco.resolver.ts | 2 +- .../business/ambientes/bloco/bloco.service.ts | 2 +- .../bloco/dtos/bloco-create.operation.ts | 2 +- .../bloco/dtos/bloco-find-one.operation.ts | 2 +- .../bloco/dtos/bloco-update.operation.ts | 2 +- .../ambientes/bloco/dtos/bloco.dto.ts | 2 +- .../ambientes/campus/campus.controller.ts | 2 +- .../ambientes/campus/campus.resolver.ts | 2 +- .../ambientes/campus/campus.service.ts | 2 +- .../campus/dtos/campus-create.operation.ts | 2 +- .../dtos/campus-delete-one.operation.ts | 2 +- .../campus/dtos/campus-find-all.operation.ts | 2 +- .../campus/dtos/campus-find-one.operation.ts | 2 +- .../campus/dtos/campus-update.operation.ts | 2 +- .../ambientes/campus/dtos/campus.dto.ts | 2 +- .../ambientes/cidade/cidade.controller.ts | 2 +- .../ambientes/cidade/cidade.resolver.ts | 4 +- .../ambientes/cidade/cidade.service.ts | 2 +- .../cidade/dtos/cidade-find-all.operation.ts | 2 +- .../cidade/dtos/cidade-find-one.operation.ts | 2 +- .../ambientes/cidade/dtos/cidade.dto.ts | 2 +- .../dtos/endereco-find-one.result.dto.ts | 2 +- .../endereco/dtos/endereco-input.dto.ts | 2 +- .../ambientes/endereco/dtos/endereco.dto.ts | 2 +- .../ambientes/endereco/endereco.service.ts | 2 +- .../estado/dtos/estado-find-all.operation.ts | 2 +- .../estado/dtos/estado-find-one.operation.ts | 2 +- .../ambientes/estado/dtos/estado.dto.ts | 2 +- .../ambientes/estado/estado.controller.ts | 2 +- .../ambientes/estado/estado.resolver.ts | 4 +- .../ambientes/estado/estado.service.ts | 4 +- .../reserva/dtos/reserva-create.operation.ts | 2 +- .../ambientes/reserva/reserva.controller.ts | 2 +- .../ambientes/reserva/reserva.resolver.ts | 2 +- .../ambientes/reserva/reserva.service.ts | 2 +- .../autenticacao/autenticacao.controller.ts | 2 +- .../autenticacao/autenticacao.resolver.ts | 2 +- .../autenticacao/autenticacao.service.ts | 2 +- .../usuario-vinculo-campus.controller.ts | 4 +- .../usuario-vinculo-campus.resolver.ts | 2 +- .../usuario-vinculo-campus.service.ts | 6 +- .../usuario/usuario.controller.ts | 2 +- .../autenticacao/usuario/usuario.module.ts | 2 +- .../autenticacao/usuario/usuario.resolver.ts | 2 +- .../autenticacao/usuario/usuario.service.ts | 8 +- .../base/arquivo/arquivo.controller.ts | 10 +- .../business/base/arquivo/arquivo.dtos.ts | 61 +---- .../business/base/arquivo/arquivo.service.ts | 2 +- .../imagem-arquivo/imagem-arquivo.dtos.ts | 6 +- .../business/base/imagem/imagem.dtos.ts | 8 +- .../calendario-letivo.controller.ts | 4 +- .../calendario-letivo.resolver.ts | 4 +- .../calendario-letivo.service.ts | 2 +- .../calendario-letivo-create.operation.ts | 2 +- .../business/ensino/curso/curso.controller.ts | 2 +- .../business/ensino/curso/curso.resolver.ts | 2 +- .../business/ensino/curso/curso.service.ts | 2 +- .../curso/dtos/curso-create.operation.ts | 2 +- .../curso/dtos/curso-delete-one.operation.ts | 2 +- .../curso/dtos/curso-find-all.operation.ts | 2 +- .../curso/dtos/curso-find-one.operation.ts | 2 +- .../curso/dtos/curso-input.operation.ts | 2 +- .../curso/dtos/curso-update.operation.ts | 2 +- .../business/ensino/curso/dtos/curso.dto.ts | 6 +- .../diario-professor.controller.ts | 2 +- .../diario-professor.resolver.ts | 2 +- .../diario-professor.service.ts | 2 +- .../dtos/diario-professor-create.operation.ts | 2 +- .../ensino/diario/diario.controller.ts | 2 +- .../business/ensino/diario/diario.resolver.ts | 2 +- .../business/ensino/diario/diario.service.ts | 2 +- .../diario/dtos/diario-create.operation.ts | 2 +- .../disciplina/disciplina.controller.ts | 2 +- .../ensino/disciplina/disciplina.resolver.ts | 2 +- .../ensino/disciplina/disciplina.service.ts | 2 +- .../dtos/disciplina-create.operation.ts | 2 +- .../dtos/modalidade-create.operation.ts | 2 +- .../dtos/modalidade-delete-one.operation.ts | 2 +- .../dtos/modalidade-find-all.operation.ts | 2 +- .../dtos/modalidade-find-one.operation.ts | 2 +- .../dtos/modalidade-input.operation.ts | 2 +- .../dtos/modalidade-update.operation.ts | 2 +- .../ensino/modalidade/dtos/modalidade.dto.ts | 2 +- .../modalidade/modalidade.controller.ts | 2 +- .../ensino/modalidade/modalidade.resolver.ts | 4 +- .../ensino/modalidade/modalidade.service.ts | 2 +- .../turma/dtos/turma-create.operation.ts | 2 +- .../business/ensino/turma/turma.controller.ts | 2 +- .../business/ensino/turma/turma.resolver.ts | 2 +- .../business/ensino/turma/turma.service.ts | 2 +- src/application/utils/qbEfficientLoad.ts | 8 +- src/domain/authorization/IBaseAuthz.ts | 2 +- .../core/ContextoDeAcesso.ts | 2 +- .../environment-config.service.ts | 7 +- .../typeorm/entities/ambientes/index.ts | 7 + .../typeorm/entities/autenticacao/index.ts | 2 + .../typeorm/entities/base/index.ts | 3 + .../typeorm/entities/calendario/index.ts | 1 + .../typeorm/entities/ensino/index.ts | 7 + .../typeorm/entities/index.ts | 5 + .../usuario-vinculo-campus.entity.ts | 39 --- src/infrastructure/utils/createDtoClass.ts | 78 +++++- src/infrastructure/utils/dirname.ts | 5 + .../validation/yup/ValidationPipeYup.ts | 3 +- src/main.ts | 22 +- tsconfig.json | 11 +- 118 files changed, 491 insertions(+), 255 deletions(-) create mode 100644 src/infrastructure/integrate-database/typeorm/entities/ambientes/index.ts create mode 100644 src/infrastructure/integrate-database/typeorm/entities/autenticacao/index.ts create mode 100644 src/infrastructure/integrate-database/typeorm/entities/base/index.ts create mode 100644 src/infrastructure/integrate-database/typeorm/entities/calendario/index.ts create mode 100644 src/infrastructure/integrate-database/typeorm/entities/ensino/index.ts create mode 100644 src/infrastructure/integrate-database/typeorm/entities/index.ts delete mode 100644 src/infrastructure/integrate-database/typeorm/entities/usuario-vinculo-campus/usuario-vinculo-campus.entity.ts create mode 100644 src/infrastructure/utils/dirname.ts diff --git a/package-lock.json b/package-lock.json index 77d976a5..370e4a2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "@nestjs/schedule": "^4.0.2", "@nestjs/swagger": "^7.3.0", "@nestjs/throttler": "^5.1.2", - "@sisgea/spec": "^1.1.0-development.36", + "@sisgea/spec": "^1.1.0-development.38", "compression": "^1.7.4", "fs-jetpack": "^5.1.0", "graphql": "^16.8.1", @@ -4322,9 +4322,9 @@ } }, "node_modules/@sisgea/spec": { - "version": "1.1.0-development.36", - "resolved": "https://registry.npmjs.org/@sisgea/spec/-/spec-1.1.0-development.36.tgz", - "integrity": "sha512-vjgWCsQ1LDU7OiA4bBZ9Xy0Q3LeJXif2PGpVmBnpUwzejs8ArQkXGUm1DQMjqaVsHYddzTwBtd6Lh1vguh7IUQ==", + "version": "1.1.0-development.38", + "resolved": "https://registry.npmjs.org/@sisgea/spec/-/spec-1.1.0-development.38.tgz", + "integrity": "sha512-SqYogOjhIUvJ/gWU2c2ithkrIGAlDSngX73eBW7pLUXAx/U78A9bNNXHqlc+qZnIzxzz9GYh/tMh+lNPm4Q94Q==", "optionalDependencies": { "yup": "^1.4.0" } @@ -4334,6 +4334,235 @@ "resolved": "https://registry.npmjs.org/@sqltools/formatter/-/formatter-1.2.5.tgz", "integrity": "sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw==" }, + "node_modules/@swc/core": { + "version": "1.4.17", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.4.17.tgz", + "integrity": "sha512-tq+mdWvodMBNBBZbwFIMTVGYHe9N7zvEaycVVjfvAx20k1XozHbHhRv+9pEVFJjwRxLdXmtvFZd3QZHRAOpoNQ==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "peer": true, + "dependencies": { + "@swc/counter": "^0.1.2", + "@swc/types": "^0.1.5" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/swc" + }, + "optionalDependencies": { + "@swc/core-darwin-arm64": "1.4.17", + "@swc/core-darwin-x64": "1.4.17", + "@swc/core-linux-arm-gnueabihf": "1.4.17", + "@swc/core-linux-arm64-gnu": "1.4.17", + "@swc/core-linux-arm64-musl": "1.4.17", + "@swc/core-linux-x64-gnu": "1.4.17", + "@swc/core-linux-x64-musl": "1.4.17", + "@swc/core-win32-arm64-msvc": "1.4.17", + "@swc/core-win32-ia32-msvc": "1.4.17", + "@swc/core-win32-x64-msvc": "1.4.17" + }, + "peerDependencies": { + "@swc/helpers": "^0.5.0" + }, + "peerDependenciesMeta": { + "@swc/helpers": { + "optional": true + } + } + }, + "node_modules/@swc/core-darwin-arm64": { + "version": "1.4.17", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.17.tgz", + "integrity": "sha512-HVl+W4LezoqHBAYg2JCqR+s9ife9yPfgWSj37iIawLWzOmuuJ7jVdIB7Ee2B75bEisSEKyxRlTl6Y1Oq3owBgw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-darwin-x64": { + "version": "1.4.17", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.17.tgz", + "integrity": "sha512-WYRO9Fdzq4S/he8zjW5I95G1zcvyd9yyD3Tgi4/ic84P5XDlSMpBDpBLbr/dCPjmSg7aUXxNQqKqGkl6dQxYlA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm-gnueabihf": { + "version": "1.4.17", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.4.17.tgz", + "integrity": "sha512-cgbvpWOvtMH0XFjvwppUCR+Y+nf6QPaGu6AQ5hqCP+5Lv2zO5PG0RfasC4zBIjF53xgwEaaWmGP5/361P30X8Q==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-gnu": { + "version": "1.4.17", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.4.17.tgz", + "integrity": "sha512-l7zHgaIY24cF9dyQ/FOWbmZDsEj2a9gRFbmgx2u19e3FzOPuOnaopFj0fRYXXKCmtdx+anD750iBIYnTR+pq/Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-musl": { + "version": "1.4.17", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.4.17.tgz", + "integrity": "sha512-qhH4gr9gAlVk8MBtzXbzTP3BJyqbAfUOATGkyUtohh85fPXQYuzVlbExix3FZXTwFHNidGHY8C+ocscI7uDaYw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-gnu": { + "version": "1.4.17", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.4.17.tgz", + "integrity": "sha512-vRDFATL1oN5oZMImkwbgSHEkp8xG1ofEASBypze01W1Tqto8t+yo6gsp69wzCZBlxldsvPpvFZW55Jq0Rn+UnA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-musl": { + "version": "1.4.17", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.4.17.tgz", + "integrity": "sha512-zQNPXAXn3nmPqv54JVEN8k2JMEcMTQ6veVuU0p5O+A7KscJq+AGle/7ZQXzpXSfUCXlLMX4wvd+rwfGhh3J4cw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-arm64-msvc": { + "version": "1.4.17", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.4.17.tgz", + "integrity": "sha512-z86n7EhOwyzxwm+DLE5NoLkxCTme2lq7QZlDjbQyfCxOt6isWz8rkW5QowTX8w9Rdmk34ncrjSLvnHOeLY17+w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-ia32-msvc": { + "version": "1.4.17", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.4.17.tgz", + "integrity": "sha512-JBwuSTJIgiJJX6wtr4wmXbfvOswHFj223AumUrK544QV69k60FJ9q2adPW9Csk+a8wm1hLxq4HKa2K334UHJ/g==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-x64-msvc": { + "version": "1.4.17", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.4.17.tgz", + "integrity": "sha512-jFkOnGQamtVDBm3MF5Kq1lgW8vx4Rm1UvJWRUfg+0gx7Uc3Jp3QMFeMNw/rDNQYRDYPG3yunCC+2463ycd5+dg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/counter": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@swc/types": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.6.tgz", + "integrity": "sha512-/JLo/l2JsT/LRd80C3HfbmVpxOAJ11FO2RCEslFrgzLltoP9j8XIbsyDcfCt2WWyX+CM96rBoNM+IToAkFOugg==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@swc/counter": "^0.1.3" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", diff --git a/package.json b/package.json index 4559c2d2..cba046f5 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@nestjs/schedule": "^4.0.2", "@nestjs/swagger": "^7.3.0", "@nestjs/throttler": "^5.1.2", - "@sisgea/spec": "^1.1.0-development.36", + "@sisgea/spec": "^1.1.0-development.38", "compression": "^1.7.4", "fs-jetpack": "^5.1.0", "graphql": "^16.8.1", diff --git a/plop/generators/module-core/hbs/core-module/controller.ts.hbs b/plop/generators/module-core/hbs/core-module/controller.ts.hbs index 6cd2e0c7..4e067d13 100644 --- a/plop/generators/module-core/hbs/core-module/controller.ts.hbs +++ b/plop/generators/module-core/hbs/core-module/controller.ts.hbs @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Patch, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; import * as Dto from '../../(spec)'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/plop/generators/module-core/hbs/core-module/service.ts.hbs b/plop/generators/module-core/hbs/core-module/service.ts.hbs index ecd536d9..ff4e3106 100644 --- a/plop/generators/module-core/hbs/core-module/service.ts.hbs +++ b/plop/generators/module-core/hbs/core-module/service.ts.hbs @@ -3,7 +3,7 @@ import { map, pick } from 'lodash'; import { paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; import * as Dtos from '../../(spec)'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { {{ c_pascal moduleName }}Entity } from '../../../../infrastructure/integrate-database/typeorm/entities/{{ c_kebab moduleNameParent }}/{{ c_snake moduleName }}.entity'; diff --git a/src/application/business/ambientes/ambiente/ambiente.controller.ts b/src/application/business/ambientes/ambiente/ambiente.controller.ts index 028754fe..0904bf12 100644 --- a/src/application/business/ambientes/ambiente/ambiente.controller.ts +++ b/src/application/business/ambientes/ambiente/ambiente.controller.ts @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Param, ParseUUIDPipe, Patch, Post, Put, Upload import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/src/application/business/ambientes/ambiente/ambiente.resolver.ts b/src/application/business/ambientes/ambiente/ambiente.resolver.ts index c1f35094..5040b751 100644 --- a/src/application/business/ambientes/ambiente/ambiente.resolver.ts +++ b/src/application/business/ambientes/ambiente/ambiente.resolver.ts @@ -1,6 +1,6 @@ import { Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { AmbienteService } from './ambiente.service'; diff --git a/src/application/business/ambientes/ambiente/ambiente.service.ts b/src/application/business/ambientes/ambiente/ambiente.service.ts index fce652ee..51b1b651 100644 --- a/src/application/business/ambientes/ambiente/ambiente.service.ts +++ b/src/application/business/ambientes/ambiente/ambiente.service.ts @@ -4,7 +4,7 @@ import { AppResource, AppResourceView } from 'application/utils/qbEfficientLoad' import { map, pick } from 'lodash'; import { FilterOperator, paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { AmbienteEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/ambientes/ambiente.entity'; diff --git a/src/application/business/ambientes/ambiente/dtos/ambiente-create.operation.ts b/src/application/business/ambientes/ambiente/dtos/ambiente-create.operation.ts index 9f8a22f8..211ffece 100644 --- a/src/application/business/ambientes/ambiente/dtos/ambiente-create.operation.ts +++ b/src/application/business/ambientes/ambiente/dtos/ambiente-create.operation.ts @@ -1,10 +1,10 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from '../../../../../infrastructure'; import { AmbienteFindOneResultDto } from './ambiente-find-one.operation'; import { AmbienteInputDtoValidationContract } from './ambiente-input.operation'; import { AmbienteDto } from './ambiente.dto'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ====================================================== export const AmbienteCreateDto = createEntityDtoClass(Spec.AmbienteInputDeclaration, 'input'); diff --git a/src/application/business/ambientes/ambiente/dtos/ambiente-find-one.operation.ts b/src/application/business/ambientes/ambiente/dtos/ambiente-find-one.operation.ts index 9732795a..6a23be4a 100644 --- a/src/application/business/ambientes/ambiente/dtos/ambiente-find-one.operation.ts +++ b/src/application/business/ambientes/ambiente/dtos/ambiente-find-one.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractUuid, createDtoOperationOptions, createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { AmbienteDto, AmbienteDtoValidationContract } from './ambiente.dto'; // ====================================================== diff --git a/src/application/business/ambientes/ambiente/dtos/ambiente-update.operation.ts b/src/application/business/ambientes/ambiente/dtos/ambiente-update.operation.ts index 5f71c918..51b6dd66 100644 --- a/src/application/business/ambientes/ambiente/dtos/ambiente-update.operation.ts +++ b/src/application/business/ambientes/ambiente/dtos/ambiente-update.operation.ts @@ -20,7 +20,7 @@ export const AmbienteUpdateInputDtoValidationContract = createValidationContract // ====================================================== import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ====================================================== export const AmbienteUpdateInputDto = createEntityDtoClass(Spec.AmbienteUpdateDeclaration, 'input'); // ====================================================== diff --git a/src/application/business/ambientes/ambiente/dtos/ambiente.dto.ts b/src/application/business/ambientes/ambiente/dtos/ambiente.dto.ts index d1eb85d7..bf263a85 100644 --- a/src/application/business/ambientes/ambiente/dtos/ambiente.dto.ts +++ b/src/application/business/ambientes/ambiente/dtos/ambiente.dto.ts @@ -1,6 +1,5 @@ import { Int } from '@nestjs/graphql'; import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { CommonPropertyUuid, @@ -12,6 +11,7 @@ import { createDtoPropertyMap, createValidationContract, } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { ImagemDto, ImagemFindOneResultDto } from '../../../base/imagem/imagem.dtos'; import { BlocoDto, BlocoFindOneResultDto } from '../../bloco/dtos'; diff --git a/src/application/business/ambientes/bloco/bloco.controller.ts b/src/application/business/ambientes/bloco/bloco.controller.ts index e8432a8a..1ad7e1ad 100644 --- a/src/application/business/ambientes/bloco/bloco.controller.ts +++ b/src/application/business/ambientes/bloco/bloco.controller.ts @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Param, ParseUUIDPipe, Patch, Post, Put, Upload import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/src/application/business/ambientes/bloco/bloco.resolver.ts b/src/application/business/ambientes/bloco/bloco.resolver.ts index d41b96df..cf883a54 100644 --- a/src/application/business/ambientes/bloco/bloco.resolver.ts +++ b/src/application/business/ambientes/bloco/bloco.resolver.ts @@ -1,6 +1,6 @@ import { Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { BlocoService } from './bloco.service'; diff --git a/src/application/business/ambientes/bloco/bloco.service.ts b/src/application/business/ambientes/bloco/bloco.service.ts index aa01d063..4b01fb1e 100644 --- a/src/application/business/ambientes/bloco/bloco.service.ts +++ b/src/application/business/ambientes/bloco/bloco.service.ts @@ -4,7 +4,7 @@ import { AppResource, AppResourceView } from 'application/utils/qbEfficientLoad' import { map, pick } from 'lodash'; import { FilterOperator, paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { BlocoEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/ambientes/bloco.entity'; diff --git a/src/application/business/ambientes/bloco/dtos/bloco-create.operation.ts b/src/application/business/ambientes/bloco/dtos/bloco-create.operation.ts index 9be5be36..6c05cf26 100644 --- a/src/application/business/ambientes/bloco/dtos/bloco-create.operation.ts +++ b/src/application/business/ambientes/bloco/dtos/bloco-create.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { BlocoFindOneResultDto } from './bloco-find-one.operation'; import { BlocoInputDtoValidationContract } from './bloco-input.dto'; import { BlocoDto } from './bloco.dto'; diff --git a/src/application/business/ambientes/bloco/dtos/bloco-find-one.operation.ts b/src/application/business/ambientes/bloco/dtos/bloco-find-one.operation.ts index 16d53ee1..a3bf8fc5 100644 --- a/src/application/business/ambientes/bloco/dtos/bloco-find-one.operation.ts +++ b/src/application/business/ambientes/bloco/dtos/bloco-find-one.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractUuid, createDtoOperationOptions, createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { BlocoDto, BlocoDtoValidationContract } from './bloco.dto'; // ====================================================== diff --git a/src/application/business/ambientes/bloco/dtos/bloco-update.operation.ts b/src/application/business/ambientes/bloco/dtos/bloco-update.operation.ts index 5973988e..d84c6a90 100644 --- a/src/application/business/ambientes/bloco/dtos/bloco-update.operation.ts +++ b/src/application/business/ambientes/bloco/dtos/bloco-update.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractObjectUuidBase, ValidationContractUuid, createDtoOperationOptions, createValidationContract } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { BlocoFindOneByIdInputValidationContract, BlocoFindOneResultDto } from './bloco-find-one.operation'; import { BlocoInputDtoValidationContract } from './bloco-input.dto'; import { BlocoDto } from './bloco.dto'; diff --git a/src/application/business/ambientes/bloco/dtos/bloco.dto.ts b/src/application/business/ambientes/bloco/dtos/bloco.dto.ts index e6c12394..9472146d 100644 --- a/src/application/business/ambientes/bloco/dtos/bloco.dto.ts +++ b/src/application/business/ambientes/bloco/dtos/bloco.dto.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractObjectUuidBase, ValidationContractString, ValidationContractUuid, createValidationContract } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ====================================================== diff --git a/src/application/business/ambientes/campus/campus.controller.ts b/src/application/business/ambientes/campus/campus.controller.ts index 9e5320a8..e619d1fb 100644 --- a/src/application/business/ambientes/campus/campus.controller.ts +++ b/src/application/business/ambientes/campus/campus.controller.ts @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Patch, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/src/application/business/ambientes/campus/campus.resolver.ts b/src/application/business/ambientes/campus/campus.resolver.ts index 7b369c47..98f8c649 100644 --- a/src/application/business/ambientes/campus/campus.resolver.ts +++ b/src/application/business/ambientes/campus/campus.resolver.ts @@ -1,6 +1,6 @@ import { Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { CampusService } from './campus.service'; diff --git a/src/application/business/ambientes/campus/campus.service.ts b/src/application/business/ambientes/campus/campus.service.ts index cde79da0..a359e260 100644 --- a/src/application/business/ambientes/campus/campus.service.ts +++ b/src/application/business/ambientes/campus/campus.service.ts @@ -5,7 +5,7 @@ import { get, has, map, pick } from 'lodash'; import { FilterOperator, paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; import { v4 } from 'uuid'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { CampusEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/ambientes/campus.entity'; diff --git a/src/application/business/ambientes/campus/dtos/campus-create.operation.ts b/src/application/business/ambientes/campus/dtos/campus-create.operation.ts index 39f7ec21..68d7197a 100644 --- a/src/application/business/ambientes/campus/dtos/campus-create.operation.ts +++ b/src/application/business/ambientes/campus/dtos/campus-create.operation.ts @@ -1,6 +1,6 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import { createDtoOperationOptions } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { CampusFindOneResultDto } from './campus-find-one.operation'; import { CampusInputDtoValidationContract } from './campus-input.dto'; import { CampusDto } from './campus.dto'; diff --git a/src/application/business/ambientes/campus/dtos/campus-delete-one.operation.ts b/src/application/business/ambientes/campus/dtos/campus-delete-one.operation.ts index 78616710..03c7505f 100644 --- a/src/application/business/ambientes/campus/dtos/campus-delete-one.operation.ts +++ b/src/application/business/ambientes/campus/dtos/campus-delete-one.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractUuid, createDtoOperationOptions, createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { CampusDtoValidationContract } from './campus.dto'; // ====================================================== diff --git a/src/application/business/ambientes/campus/dtos/campus-find-all.operation.ts b/src/application/business/ambientes/campus/dtos/campus-find-all.operation.ts index 767e533c..d86237e1 100644 --- a/src/application/business/ambientes/campus/dtos/campus-find-all.operation.ts +++ b/src/application/business/ambientes/campus/dtos/campus-find-all.operation.ts @@ -1,6 +1,6 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import { SearchInputDto, SearchInputValidationContract, createDtoOperationOptions } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ============================================================= diff --git a/src/application/business/ambientes/campus/dtos/campus-find-one.operation.ts b/src/application/business/ambientes/campus/dtos/campus-find-one.operation.ts index 29f52988..92650530 100644 --- a/src/application/business/ambientes/campus/dtos/campus-find-one.operation.ts +++ b/src/application/business/ambientes/campus/dtos/campus-find-one.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractUuid, createDtoOperationOptions, createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { CampusDto, CampusDtoValidationContract } from './campus.dto'; // ====================================================== diff --git a/src/application/business/ambientes/campus/dtos/campus-update.operation.ts b/src/application/business/ambientes/campus/dtos/campus-update.operation.ts index f508db6f..8dfeb73f 100644 --- a/src/application/business/ambientes/campus/dtos/campus-update.operation.ts +++ b/src/application/business/ambientes/campus/dtos/campus-update.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractUuid, createDtoOperationOptions, createValidationContract } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { CampusFindOneByIdInputValidationContract, CampusFindOneResultDto } from './campus-find-one.operation'; import { CampusInputDtoValidationContract } from './campus-input.dto'; import { CampusDto } from './campus.dto'; diff --git a/src/application/business/ambientes/campus/dtos/campus.dto.ts b/src/application/business/ambientes/campus/dtos/campus.dto.ts index 6c1537c1..34f0e30e 100644 --- a/src/application/business/ambientes/campus/dtos/campus.dto.ts +++ b/src/application/business/ambientes/campus/dtos/campus.dto.ts @@ -1,5 +1,4 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import { uniqBy } from 'lodash'; import * as yup from 'yup'; import { @@ -11,6 +10,7 @@ import { createDtoPropertyMap, createValidationContract, } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { ModalidadeDto, ModalidadeFindOneResultDto } from '../../../ensino/modalidade/dtos'; import { EnderecoDto, EnderecoFindOneResultDto, EnderecoInputDto, EnderecoInputDtoValidationContract } from '../../endereco/dtos'; diff --git a/src/application/business/ambientes/cidade/cidade.controller.ts b/src/application/business/ambientes/cidade/cidade.controller.ts index 742dd4ec..c8abf67c 100644 --- a/src/application/business/ambientes/cidade/cidade.controller.ts +++ b/src/application/business/ambientes/cidade/cidade.controller.ts @@ -2,7 +2,7 @@ import { Controller, Get } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import * as Spec from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain/contexto-de-acesso'; +import type { IContextoDeAcesso } from '../../../../domain/contexto-de-acesso'; import { ContextoDeAcessoHttp, DtoOperationFindAll, DtoOperationFindOne, HttpDtoParam, getSearchInputFromPaginateQuery } from '../../../../infrastructure'; import { CidadeService } from './cidade.service'; import { CidadeOperations } from './dtos'; diff --git a/src/application/business/ambientes/cidade/cidade.resolver.ts b/src/application/business/ambientes/cidade/cidade.resolver.ts index 771f9607..0f5c7c07 100644 --- a/src/application/business/ambientes/cidade/cidade.resolver.ts +++ b/src/application/business/ambientes/cidade/cidade.resolver.ts @@ -1,8 +1,8 @@ import { Info, Resolver } from '@nestjs/graphql'; import { ICidadeFindOneByIdInputDto, ISearchInputDto } from '@sisgea/spec'; -import { GraphQLResolveInfo } from 'graphql'; +import type { GraphQLResolveInfo } from 'graphql'; import getFieldNames from 'graphql-list-fields'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlQuery, GqlDtoInput } from '../../../../infrastructure'; import { CidadeService } from './cidade.service'; import { CidadeOperations } from './dtos'; diff --git a/src/application/business/ambientes/cidade/cidade.service.ts b/src/application/business/ambientes/cidade/cidade.service.ts index b4cbbd36..aa10d4de 100644 --- a/src/application/business/ambientes/cidade/cidade.service.ts +++ b/src/application/business/ambientes/cidade/cidade.service.ts @@ -3,7 +3,7 @@ import * as Dto from '@sisgea/spec'; import { AppResource, AppResourceView } from 'application/utils/qbEfficientLoad'; import { map } from 'lodash'; import { FilterOperator, paginate } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain/contexto-de-acesso'; +import type { IContextoDeAcesso } from '../../../../domain/contexto-de-acesso'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { paginateConfig } from '../../../../infrastructure/utils/paginateConfig'; diff --git a/src/application/business/ambientes/cidade/dtos/cidade-find-all.operation.ts b/src/application/business/ambientes/cidade/dtos/cidade-find-all.operation.ts index b3e9818b..1ccf914b 100644 --- a/src/application/business/ambientes/cidade/dtos/cidade-find-all.operation.ts +++ b/src/application/business/ambientes/cidade/dtos/cidade-find-all.operation.ts @@ -1,6 +1,6 @@ import * as Spec from '@sisgea/spec'; import { SearchInputDto, SearchInputValidationContract, createDtoOperationOptions } from '../../../../../infrastructure'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ============================================================= diff --git a/src/application/business/ambientes/cidade/dtos/cidade-find-one.operation.ts b/src/application/business/ambientes/cidade/dtos/cidade-find-one.operation.ts index 5ae2de26..274b54f3 100644 --- a/src/application/business/ambientes/cidade/dtos/cidade-find-one.operation.ts +++ b/src/application/business/ambientes/cidade/dtos/cidade-find-one.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractId, createDtoOperationOptions, createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { CidadeDto, CidadeDtoValidationContract } from './cidade.dto'; // ====================================================== diff --git a/src/application/business/ambientes/cidade/dtos/cidade.dto.ts b/src/application/business/ambientes/cidade/dtos/cidade.dto.ts index 5dc2c0fb..10a2312d 100644 --- a/src/application/business/ambientes/cidade/dtos/cidade.dto.ts +++ b/src/application/business/ambientes/cidade/dtos/cidade.dto.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractId, ValidationContractString, createValidationContract } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ====================================================== diff --git a/src/application/business/ambientes/endereco/dtos/endereco-find-one.result.dto.ts b/src/application/business/ambientes/endereco/dtos/endereco-find-one.result.dto.ts index 8b08f3d1..0b018170 100644 --- a/src/application/business/ambientes/endereco/dtos/endereco-find-one.result.dto.ts +++ b/src/application/business/ambientes/endereco/dtos/endereco-find-one.result.dto.ts @@ -1,5 +1,5 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ====================================================== diff --git a/src/application/business/ambientes/endereco/dtos/endereco-input.dto.ts b/src/application/business/ambientes/endereco/dtos/endereco-input.dto.ts index 5b7da5a9..ca2a7a2c 100644 --- a/src/application/business/ambientes/endereco/dtos/endereco-input.dto.ts +++ b/src/application/business/ambientes/endereco/dtos/endereco-input.dto.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { EnderecoDtoValidationContract } from './endereco.dto'; // ====================================================== diff --git a/src/application/business/ambientes/endereco/dtos/endereco.dto.ts b/src/application/business/ambientes/endereco/dtos/endereco.dto.ts index f8ca80d3..983473d6 100644 --- a/src/application/business/ambientes/endereco/dtos/endereco.dto.ts +++ b/src/application/business/ambientes/endereco/dtos/endereco.dto.ts @@ -1,5 +1,4 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractLocalizacaoCep, @@ -9,6 +8,7 @@ import { ValidationContractUuid, createValidationContract, } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ====================================================== diff --git a/src/application/business/ambientes/endereco/endereco.service.ts b/src/application/business/ambientes/endereco/endereco.service.ts index edb3c901..6658eece 100644 --- a/src/application/business/ambientes/endereco/endereco.service.ts +++ b/src/application/business/ambientes/endereco/endereco.service.ts @@ -3,7 +3,7 @@ import { IEnderecoFindOneByIdInputDto, IEnderecoFindOneResultDto, IEnderecoInput import { AppResource, AppResourceView } from 'application/utils/qbEfficientLoad'; import { pick } from 'lodash'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { parsePayloadYup } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { EnderecoInputDtoValidationContract } from './dtos'; diff --git a/src/application/business/ambientes/estado/dtos/estado-find-all.operation.ts b/src/application/business/ambientes/estado/dtos/estado-find-all.operation.ts index ee50910a..3854dd53 100644 --- a/src/application/business/ambientes/estado/dtos/estado-find-all.operation.ts +++ b/src/application/business/ambientes/estado/dtos/estado-find-all.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import { SearchInputDto, SearchInputValidationContract } from '../../../../../infrastructure'; import { createDtoOperationOptions } from '../../../../../infrastructure/api-documentate/DtoOperation'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ============================================================= diff --git a/src/application/business/ambientes/estado/dtos/estado-find-one.operation.ts b/src/application/business/ambientes/estado/dtos/estado-find-one.operation.ts index 4ab4457b..9422a45d 100644 --- a/src/application/business/ambientes/estado/dtos/estado-find-one.operation.ts +++ b/src/application/business/ambientes/estado/dtos/estado-find-one.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractId, createDtoOperationOptions, createValidationContract, createValidationContractPickField, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { EstadoDto, EstadoDtoValidationContract } from './estado.dto'; // ====================================================== diff --git a/src/application/business/ambientes/estado/dtos/estado.dto.ts b/src/application/business/ambientes/estado/dtos/estado.dto.ts index fcc24950..90301c5e 100644 --- a/src/application/business/ambientes/estado/dtos/estado.dto.ts +++ b/src/application/business/ambientes/estado/dtos/estado.dto.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractId, ValidationContractString, createValidationContract } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ====================================================== diff --git a/src/application/business/ambientes/estado/estado.controller.ts b/src/application/business/ambientes/estado/estado.controller.ts index b2ddf760..09ee9da7 100644 --- a/src/application/business/ambientes/estado/estado.controller.ts +++ b/src/application/business/ambientes/estado/estado.controller.ts @@ -2,7 +2,7 @@ import { Controller, Get } from '@nestjs/common'; import { ApiParam, ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationFindAll, DtoOperationFindOne, HttpDtoParam, getSearchInputFromPaginateQuery } from '../../../../infrastructure'; import { EstadoOperations } from './dtos/estado.operations'; import { EstadoService } from './estado.service'; diff --git a/src/application/business/ambientes/estado/estado.resolver.ts b/src/application/business/ambientes/estado/estado.resolver.ts index d6ff1b55..d7a4baaf 100644 --- a/src/application/business/ambientes/estado/estado.resolver.ts +++ b/src/application/business/ambientes/estado/estado.resolver.ts @@ -1,8 +1,8 @@ import { Info, Resolver } from '@nestjs/graphql'; import { IEstadoFindOneByIdInputDto, IEstadoFindOneByUfInputDto, ISearchInputDto } from '@sisgea/spec'; -import { GraphQLResolveInfo } from 'graphql'; +import type { GraphQLResolveInfo } from 'graphql'; import getFieldNames from 'graphql-list-fields'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlQuery, GqlDtoInput } from '../../../../infrastructure'; import { EstadoOperations } from './dtos/estado.operations'; import { EstadoService } from './estado.service'; diff --git a/src/application/business/ambientes/estado/estado.service.ts b/src/application/business/ambientes/estado/estado.service.ts index 21c358fa..ce9ce6d6 100644 --- a/src/application/business/ambientes/estado/estado.service.ts +++ b/src/application/business/ambientes/estado/estado.service.ts @@ -2,12 +2,12 @@ import { Injectable, NotFoundException } from '@nestjs/common'; import * as Dto from '@sisgea/spec'; import { IEstadoFindOneByIdInputDto, IEstadoFindOneByUfInputDto } from '@sisgea/spec'; import { AppResource, AppResourceView } from 'application/utils/qbEfficientLoad'; -import { paginateConfig } from 'infrastructure/utils/paginateConfig'; import { map } from 'lodash'; import { paginate } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; +import { paginateConfig } from '../../../../infrastructure/utils/paginateConfig'; const aliasEstado = 'estado'; diff --git a/src/application/business/ambientes/reserva/dtos/reserva-create.operation.ts b/src/application/business/ambientes/reserva/dtos/reserva-create.operation.ts index 15906067..ce15c8c4 100644 --- a/src/application/business/ambientes/reserva/dtos/reserva-create.operation.ts +++ b/src/application/business/ambientes/reserva/dtos/reserva-create.operation.ts @@ -1,7 +1,7 @@ // ====================================================== -import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from 'infrastructure'; import * as yup from 'yup'; +import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from '../../../../../infrastructure'; import { ReservaFindOneResultDto } from './reserva-find-one.operation'; import { ReservaInputDto, ReservaInputDtoValidationContract } from './reserva-input.operation'; import { ReservaDto } from './reserva.dto'; diff --git a/src/application/business/ambientes/reserva/reserva.controller.ts b/src/application/business/ambientes/reserva/reserva.controller.ts index 09d13c36..18e086d2 100644 --- a/src/application/business/ambientes/reserva/reserva.controller.ts +++ b/src/application/business/ambientes/reserva/reserva.controller.ts @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Patch, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/src/application/business/ambientes/reserva/reserva.resolver.ts b/src/application/business/ambientes/reserva/reserva.resolver.ts index 9ac44529..a923d4c2 100644 --- a/src/application/business/ambientes/reserva/reserva.resolver.ts +++ b/src/application/business/ambientes/reserva/reserva.resolver.ts @@ -1,6 +1,6 @@ import { Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { ReservaOperations } from './dtos'; diff --git a/src/application/business/ambientes/reserva/reserva.service.ts b/src/application/business/ambientes/reserva/reserva.service.ts index 5acdc965..26dd423f 100644 --- a/src/application/business/ambientes/reserva/reserva.service.ts +++ b/src/application/business/ambientes/reserva/reserva.service.ts @@ -3,7 +3,7 @@ import * as Dtos from '@sisgea/spec'; import { has, map, pick } from 'lodash'; import { FilterOperator, paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { ReservaEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/ambientes/reserva.entity'; diff --git a/src/application/business/autenticacao/autenticacao.controller.ts b/src/application/business/autenticacao/autenticacao.controller.ts index 5aef30b1..dabb66a0 100644 --- a/src/application/business/autenticacao/autenticacao.controller.ts +++ b/src/application/business/autenticacao/autenticacao.controller.ts @@ -1,7 +1,7 @@ import { Controller, Get, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../domain'; +import type { IContextoDeAcesso } from '../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, DtoOperationFindOne, HttpDtoBody } from '../../../infrastructure'; import { Public } from '../../../infrastructure/authentication'; import { AutenticacaoOperations } from './autenticacao.dtos'; diff --git a/src/application/business/autenticacao/autenticacao.resolver.ts b/src/application/business/autenticacao/autenticacao.resolver.ts index fce697ba..b0a3d6ca 100644 --- a/src/application/business/autenticacao/autenticacao.resolver.ts +++ b/src/application/business/autenticacao/autenticacao.resolver.ts @@ -1,7 +1,7 @@ import { Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery, GqlDtoInput } from 'infrastructure'; -import { IContextoDeAcesso } from '../../../domain'; +import type { IContextoDeAcesso } from '../../../domain'; import { AutenticacaoOperations } from './autenticacao.dtos'; import { AutenticacaoService } from './autenticacao.service'; diff --git a/src/application/business/autenticacao/autenticacao.service.ts b/src/application/business/autenticacao/autenticacao.service.ts index 0838a9b9..c06628c6 100644 --- a/src/application/business/autenticacao/autenticacao.service.ts +++ b/src/application/business/autenticacao/autenticacao.service.ts @@ -3,7 +3,7 @@ import * as Dto from '@sisgea/spec'; import { DatabaseContextService } from 'infrastructure'; import { KeycloakService } from 'infrastructure/authentication/idp-external-connect/keycloak'; import { BaseClient, TokenSet } from 'openid-client'; -import { IContextoDeAcesso } from '../../../domain'; +import type { IContextoDeAcesso } from '../../../domain'; import { OpenidConnectService } from '../../../infrastructure/authentication/idp-external-connect/openid-connect/openid-connect.service'; import { UsuarioService } from './usuario/usuario.service'; diff --git a/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.controller.ts b/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.controller.ts index 3ef52542..31e22e97 100644 --- a/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.controller.ts +++ b/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.controller.ts @@ -1,9 +1,9 @@ import { Controller, Get, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; -import { ContextoDeAcessoHttp, DtoOperationFindAll, DtoOperationUpdate, HttpDtoBody } from 'infrastructure'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; +import { ContextoDeAcessoHttp, DtoOperationFindAll, DtoOperationUpdate, HttpDtoBody } from '../../../../infrastructure'; import { UsuarioVinculoCampusOperations } from './dtos'; import { UsuarioVinculoCampusService } from './usuario-vinculo-campus.service'; diff --git a/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.resolver.ts b/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.resolver.ts index 041a491d..5488030f 100644 --- a/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.resolver.ts +++ b/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.resolver.ts @@ -1,5 +1,5 @@ import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { UsuarioVinculoCampusOperations } from './dtos'; diff --git a/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.service.ts b/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.service.ts index a7c980a3..4d254224 100644 --- a/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.service.ts +++ b/src/application/business/autenticacao/usuario-vinculo-campus/usuario-vinculo-campus.service.ts @@ -2,11 +2,11 @@ import { Injectable, NotFoundException } from '@nestjs/common'; import * as Dto from '@sisgea/spec'; import { CampusService, ICampusQueryBuilderViewOptions } from 'application/business/ambientes/campus/campus.service'; import { IQueryBuilderViewOptionsLoad, getQueryBuilderViewLoadMeta } from 'application/utils/QueryBuilderViewOptionsLoad'; -import { DatabaseContextService } from 'infrastructure'; -import { paginateConfig } from 'infrastructure/utils/paginateConfig'; import { FilterOperator, PaginateQuery, paginate } from 'nestjs-paginate'; import { NotBrackets, SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; +import { DatabaseContextService } from '../../../../infrastructure'; +import { paginateConfig } from '../../../../infrastructure/utils/paginateConfig'; import { UsuarioService } from '../usuario/usuario.service'; // ============================================================================ diff --git a/src/application/business/autenticacao/usuario/usuario.controller.ts b/src/application/business/autenticacao/usuario/usuario.controller.ts index c63f06d5..3cb3073b 100644 --- a/src/application/business/autenticacao/usuario/usuario.controller.ts +++ b/src/application/business/autenticacao/usuario/usuario.controller.ts @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Param, ParseUUIDPipe, Patch, Post, Put, Upload import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/src/application/business/autenticacao/usuario/usuario.module.ts b/src/application/business/autenticacao/usuario/usuario.module.ts index ef05c963..1149eee6 100644 --- a/src/application/business/autenticacao/usuario/usuario.module.ts +++ b/src/application/business/autenticacao/usuario/usuario.module.ts @@ -1,5 +1,5 @@ import { Module } from '@nestjs/common'; -import { KeycloakModule } from 'infrastructure/authentication/idp-external-connect/keycloak'; +import { KeycloakModule } from '../../../../infrastructure/authentication/idp-external-connect/keycloak'; import { UsuarioController } from './usuario.controller'; import { UsuarioResolver } from './usuario.resolver'; import { UsuarioService } from './usuario.service'; diff --git a/src/application/business/autenticacao/usuario/usuario.resolver.ts b/src/application/business/autenticacao/usuario/usuario.resolver.ts index a8164004..029d9520 100644 --- a/src/application/business/autenticacao/usuario/usuario.resolver.ts +++ b/src/application/business/autenticacao/usuario/usuario.resolver.ts @@ -1,6 +1,6 @@ import { Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { UsuarioDto, UsuarioOperations } from './usuario.dtos'; diff --git a/src/application/business/autenticacao/usuario/usuario.service.ts b/src/application/business/autenticacao/usuario/usuario.service.ts index e60744c1..81b4cf9b 100644 --- a/src/application/business/autenticacao/usuario/usuario.service.ts +++ b/src/application/business/autenticacao/usuario/usuario.service.ts @@ -1,14 +1,14 @@ import { Injectable, InternalServerErrorException, NotFoundException, ServiceUnavailableException } from '@nestjs/common'; import * as Dtos from '@sisgea/spec'; import { AppResource, AppResourceView } from 'application/utils/qbEfficientLoad'; -import { ValidationFailedException, getPaginateQueryFromSearchInput, getPaginatedResultDto } from 'infrastructure'; -import { KeycloakService } from 'infrastructure/authentication/idp-external-connect/keycloak'; -import { UsuarioEntity } from 'infrastructure/integrate-database/typeorm/entities/autenticacao/usuario.entity'; import { has, map, pick } from 'lodash'; import { paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; +import { ValidationFailedException, getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; +import { KeycloakService } from '../../../../infrastructure/authentication/idp-external-connect/keycloak'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; +import { UsuarioEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/autenticacao/usuario.entity'; import { paginateConfig } from '../../../../infrastructure/utils/paginateConfig'; import { IQueryBuilderViewOptionsLoad, getQueryBuilderViewLoadMeta } from '../../../utils/QueryBuilderViewOptionsLoad'; import { ArquivoService } from '../../base/arquivo/arquivo.service'; diff --git a/src/application/business/base/arquivo/arquivo.controller.ts b/src/application/business/base/arquivo/arquivo.controller.ts index dc522f63..d265136c 100644 --- a/src/application/business/base/arquivo/arquivo.controller.ts +++ b/src/application/business/base/arquivo/arquivo.controller.ts @@ -1,6 +1,6 @@ import { Controller, Get, StreamableFile } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationGetFile, HttpDtoParam } from '../../../../infrastructure'; import { HttpDtoQuery } from '../../../../infrastructure/api-documentate/HttpDtoQuery'; import { ArquivoOperations } from './arquivo.dtos'; @@ -12,12 +12,12 @@ export class ArquivoController { constructor(private arquivoService: ArquivoService) {} @Get(':id') - @DtoOperationGetFile(ArquivoOperations.ARQUIVO_GET_FILE) + @DtoOperationGetFile(ArquivoOperations.ArquivoGetFile) async getFile( @ContextoDeAcessoHttp() contextoDeAcesso: IContextoDeAcesso, - @HttpDtoParam(ArquivoOperations.ARQUIVO_GET_FILE, 'id') id: string, - @HttpDtoQuery(ArquivoOperations.ARQUIVO_GET_FILE, 'acesso.recurso.nome') acessoRecursoNome: string, - @HttpDtoQuery(ArquivoOperations.ARQUIVO_GET_FILE, 'acesso.recurso.id') acessoRecursoId: string, + @HttpDtoParam(ArquivoOperations.ArquivoGetFile, 'id') id: string, + @HttpDtoQuery(ArquivoOperations.ArquivoGetFile, 'acesso.recurso.nome') acessoRecursoNome: string, + @HttpDtoQuery(ArquivoOperations.ArquivoGetFile, 'acesso.recurso.id') acessoRecursoId: string, ): Promise { return this.arquivoService.getStreamableFile(contextoDeAcesso, id, { id: acessoRecursoId, diff --git a/src/application/business/base/arquivo/arquivo.dtos.ts b/src/application/business/base/arquivo/arquivo.dtos.ts index 21943699..07831688 100644 --- a/src/application/business/base/arquivo/arquivo.dtos.ts +++ b/src/application/business/base/arquivo/arquivo.dtos.ts @@ -1,64 +1,17 @@ import * as Spec from '@sisgea/spec'; import * as yup from 'yup'; -import { ValidationContractNumber, ValidationContractString, ValidationContractUuid, createDtoOperationGetFileOptions, createValidationContract } from '../../../../infrastructure'; -import { createEntityDtoClass } from '../../../../infrastructure/utils/createDtoClass'; +import { createEntityDtoClass, createOperationOptionsFromOperator } from '../../../../infrastructure/utils/createDtoClass.js'; +import { createValidationContract } from '../../../../infrastructure/validation/createValidationContract.js'; // ====================================================== -export const ArquivoDto = createEntityDtoClass(Spec.ArquivoDeclarationFactory); -export const ArquivoFindOneResultDto = createEntityDtoClass(Spec.ArquivoFindOneByIdResultDeclaration); +export const ArquivoDto = createEntityDtoClass(Spec.Arquivo); +export const ArquivoFindOneResultDto = createEntityDtoClass(Spec.ArquivoFindOneByIdResult); // ====================================================== - -export const ArquivoDtoValidationContract = createValidationContract(() => { - return yup.object({ - id: ValidationContractUuid(), - // - nome: ValidationContractString().nullable(), - mimeType: ValidationContractString().nullable(), - // - sizeBytes: ValidationContractNumber().integer().positive().required().nullable(), - storageType: ValidationContractString().nullable(), - }); -}); - +export const ArquivoDtoValidationContract = createValidationContract(() => Spec.GetSchema(Spec.GetDeclarationValidator(Spec.Arquivo()), yup)); // ====================================================== - -export const ARQUIVO_GET_FILE = createDtoOperationGetFileOptions({ - description: 'Obtêm o conteúdo de um arquivo.', - - meta: { - getFile: { - mimeType: 'application/octet-stream', - }, - }, - - swagger: { - params: [ - { - name: 'id', - description: 'ID do arquivo.', - validationContract: ValidationContractUuid, - }, - ], - - queries: [ - { - name: 'acesso.recurso.nome', - description: 'Acesso via recurso: nome', - validationContract: () => yup.string(), - }, - { - name: 'acesso.recurso.id', - description: 'Acesso via recurso: id', - validationContract: () => yup.mixed(), - }, - ], - }, -}); - +export const ArquivoGetFile = createOperationOptionsFromOperator(Spec.ArquivoGetFileOperator()); // ====================================================== - export const ArquivoOperations = { - ARQUIVO_GET_FILE: ARQUIVO_GET_FILE, + ArquivoGetFile: ArquivoGetFile, }; - // ====================================================== diff --git a/src/application/business/base/arquivo/arquivo.service.ts b/src/application/business/base/arquivo/arquivo.service.ts index f072c6a2..3a81add5 100644 --- a/src/application/business/base/arquivo/arquivo.service.ts +++ b/src/application/business/base/arquivo/arquivo.service.ts @@ -4,7 +4,7 @@ import jetpack, { createReadStream } from 'fs-jetpack'; import { writeFile } from 'node:fs/promises'; import { Readable } from 'node:stream'; import { v4 } from 'uuid'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { DatabaseContextService, EnvironmentConfigService, ValidationContractUuid } from '../../../../infrastructure'; import { UsuarioEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/autenticacao/usuario.entity'; import { ArquivoEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/base/arquivo.entity'; diff --git a/src/application/business/base/imagem-arquivo/imagem-arquivo.dtos.ts b/src/application/business/base/imagem-arquivo/imagem-arquivo.dtos.ts index 06e37b82..80b97a26 100644 --- a/src/application/business/base/imagem-arquivo/imagem-arquivo.dtos.ts +++ b/src/application/business/base/imagem-arquivo/imagem-arquivo.dtos.ts @@ -1,11 +1,11 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractNumber, ValidationContractString, ValidationContractUuid, createValidationContract } from '../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../infrastructure/utils/createDtoClass'; // ====================================================== -export const ImagemArquivoDto = createEntityDtoClass(Spec.ImagemArquivoDeclarationFactory, 'output'); -export const ImagemArquivoFindOneResultDto = createEntityDtoClass(Spec.ImagemArquivoFindOneByIdResultDeclaration, 'output'); +export const ImagemArquivoDto = createEntityDtoClass(Spec.ImagemArquivo, 'output'); +export const ImagemArquivoFindOneResultDto = createEntityDtoClass(Spec.ImagemArquivoFindOneByIdResult, 'output'); // ====================================================== export const ImagemDtoValidationContract = createValidationContract(() => { diff --git a/src/application/business/base/imagem/imagem.dtos.ts b/src/application/business/base/imagem/imagem.dtos.ts index 08cb8382..5ec942ce 100644 --- a/src/application/business/base/imagem/imagem.dtos.ts +++ b/src/application/business/base/imagem/imagem.dtos.ts @@ -1,12 +1,12 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; -import { ValidationContractString, ValidationContractUuid, createValidationContract } from '../../../../infrastructure'; +import { createValidationContract, ValidationContractUuid, ValidationContractString } from '../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../infrastructure/utils/createDtoClass'; // ====================================================== -export const ImagemDto = createEntityDtoClass(Spec.ImagemDeclarationFactory); -export const ImagemFindOneResultDto = createEntityDtoClass(Spec.ImagemFindOneResultDeclarationFactory, 'output'); +export const ImagemDto = createEntityDtoClass(Spec.Imagem); +export const ImagemFindOneResultDto = createEntityDtoClass(Spec.ImagemFindOneResult, 'output'); // ====================================================== diff --git a/src/application/business/calendario/calendario-letivo/calendario-letivo.controller.ts b/src/application/business/calendario/calendario-letivo/calendario-letivo.controller.ts index 28aa9f6a..fbda1571 100644 --- a/src/application/business/calendario/calendario-letivo/calendario-letivo.controller.ts +++ b/src/application/business/calendario/calendario-letivo/calendario-letivo.controller.ts @@ -1,6 +1,7 @@ import { Controller, Delete, Get, Patch, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, @@ -11,8 +12,7 @@ import { HttpDtoBody, HttpDtoParam, getSearchInputFromPaginateQuery, -} from 'infrastructure'; -import { IContextoDeAcesso } from '../../../../domain'; +} from '../../../../infrastructure'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; import { CalendarioLetivoService } from './calendario-letivo.service'; diff --git a/src/application/business/calendario/calendario-letivo/calendario-letivo.resolver.ts b/src/application/business/calendario/calendario-letivo/calendario-letivo.resolver.ts index 58191952..a396c0ac 100644 --- a/src/application/business/calendario/calendario-letivo/calendario-letivo.resolver.ts +++ b/src/application/business/calendario/calendario-letivo/calendario-letivo.resolver.ts @@ -1,8 +1,8 @@ import * as Dto from '@sisgea/spec'; -import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery, GqlDtoInput } from 'infrastructure'; +import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery, GqlDtoInput } from '../../../../infrastructure'; import { Resolver } from '@nestjs/graphql'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { CalendarioLetivoService } from './calendario-letivo.service'; import { CalendarioLetivoDto } from './dtos/calendario-letivo.dto'; import { CalendarioLetivoOperations } from './dtos/calendario-letivo.operations'; diff --git a/src/application/business/calendario/calendario-letivo/calendario-letivo.service.ts b/src/application/business/calendario/calendario-letivo/calendario-letivo.service.ts index b8a75d3b..3da6b368 100644 --- a/src/application/business/calendario/calendario-letivo/calendario-letivo.service.ts +++ b/src/application/business/calendario/calendario-letivo/calendario-letivo.service.ts @@ -4,7 +4,7 @@ import { AppResource, AppResourceView } from 'application/utils/qbEfficientLoad' import { has, map, pick } from 'lodash'; import { FilterOperator, paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { CalendarioLetivoEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/calendario/calendario-letivo.entity'; diff --git a/src/application/business/calendario/calendario-letivo/dtos/calendario-letivo-create.operation.ts b/src/application/business/calendario/calendario-letivo/dtos/calendario-letivo-create.operation.ts index 04ba9dbe..f79abb70 100644 --- a/src/application/business/calendario/calendario-letivo/dtos/calendario-letivo-create.operation.ts +++ b/src/application/business/calendario/calendario-letivo/dtos/calendario-letivo-create.operation.ts @@ -1,5 +1,5 @@ -import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from 'infrastructure'; import * as yup from 'yup'; +import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from '../../../../../infrastructure'; import { CalendarioLetivoFindOneByIdInputValidationContract, CalendarioLetivoFindOneResultDto } from './calendario-letivo-find-one.operation'; import { CalendarioLetivoInputDto, CalendarioLetivoInputDtoValidationContract } from './calendario-letivo-input.operation'; import { CalendarioLetivoDto } from './calendario-letivo.dto'; diff --git a/src/application/business/ensino/curso/curso.controller.ts b/src/application/business/ensino/curso/curso.controller.ts index fdbd7f0a..d34ab483 100644 --- a/src/application/business/ensino/curso/curso.controller.ts +++ b/src/application/business/ensino/curso/curso.controller.ts @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Param, ParseUUIDPipe, Patch, Post, Put, Upload import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain/contexto-de-acesso/IContextoDeAcesso'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/src/application/business/ensino/curso/curso.resolver.ts b/src/application/business/ensino/curso/curso.resolver.ts index d47dada3..804dd575 100644 --- a/src/application/business/ensino/curso/curso.resolver.ts +++ b/src/application/business/ensino/curso/curso.resolver.ts @@ -1,6 +1,6 @@ import { Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { CursoService } from './curso.service'; diff --git a/src/application/business/ensino/curso/curso.service.ts b/src/application/business/ensino/curso/curso.service.ts index 0699ddb9..89b563c3 100644 --- a/src/application/business/ensino/curso/curso.service.ts +++ b/src/application/business/ensino/curso/curso.service.ts @@ -4,7 +4,7 @@ import { AppResource, AppResourceView } from 'application/utils/qbEfficientLoad' import { has, map, pick } from 'lodash'; import { FilterOperator, paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { CursoEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/ensino/curso.entity'; diff --git a/src/application/business/ensino/curso/dtos/curso-create.operation.ts b/src/application/business/ensino/curso/dtos/curso-create.operation.ts index 7d5fdefd..2c5c1ae3 100644 --- a/src/application/business/ensino/curso/dtos/curso-create.operation.ts +++ b/src/application/business/ensino/curso/dtos/curso-create.operation.ts @@ -1,5 +1,5 @@ -import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from 'infrastructure'; import * as yup from 'yup'; +import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from '../../../../../infrastructure'; import { CursoFindOneResultDto } from './curso-find-one.operation'; import { CursoInputDto, CursoInputDtoValidationContract } from './curso-input.operation'; import { CursoDto } from './curso.dto'; diff --git a/src/application/business/ensino/curso/dtos/curso-delete-one.operation.ts b/src/application/business/ensino/curso/dtos/curso-delete-one.operation.ts index 63f8f792..2c9faa74 100644 --- a/src/application/business/ensino/curso/dtos/curso-delete-one.operation.ts +++ b/src/application/business/ensino/curso/dtos/curso-delete-one.operation.ts @@ -1,7 +1,7 @@ import { CursoDeleteOneByIdInputDeclarationFactory } from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractUuid, createDtoOperationOptions, createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { CursoDtoValidationContract } from './curso.dto'; // ====================================================== diff --git a/src/application/business/ensino/curso/dtos/curso-find-all.operation.ts b/src/application/business/ensino/curso/dtos/curso-find-all.operation.ts index 998df2d1..f8559967 100644 --- a/src/application/business/ensino/curso/dtos/curso-find-all.operation.ts +++ b/src/application/business/ensino/curso/dtos/curso-find-all.operation.ts @@ -1,6 +1,6 @@ import { CursoFindAllResultDeclaration } from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import { SearchInputDto, SearchInputValidationContract, createDtoOperationOptions } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ====================================================== diff --git a/src/application/business/ensino/curso/dtos/curso-find-one.operation.ts b/src/application/business/ensino/curso/dtos/curso-find-one.operation.ts index deaf5c4e..6f0d3d40 100644 --- a/src/application/business/ensino/curso/dtos/curso-find-one.operation.ts +++ b/src/application/business/ensino/curso/dtos/curso-find-one.operation.ts @@ -1,7 +1,7 @@ import { CursoFindOneByIdInputDeclarationFactory, CursoFindOneResultDeclaration } from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractUuid, createDtoOperationOptions, createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { CursoDto, CursoDtoValidationContract } from './curso.dto'; // ====================================================== diff --git a/src/application/business/ensino/curso/dtos/curso-input.operation.ts b/src/application/business/ensino/curso/dtos/curso-input.operation.ts index 79722198..a0c38343 100644 --- a/src/application/business/ensino/curso/dtos/curso-input.operation.ts +++ b/src/application/business/ensino/curso/dtos/curso-input.operation.ts @@ -1,7 +1,7 @@ import { CursoInputDeclaration } from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { CursoDtoValidationContract } from './curso.dto'; // ====================================================== diff --git a/src/application/business/ensino/curso/dtos/curso-update.operation.ts b/src/application/business/ensino/curso/dtos/curso-update.operation.ts index d025e4ae..a4af67b9 100644 --- a/src/application/business/ensino/curso/dtos/curso-update.operation.ts +++ b/src/application/business/ensino/curso/dtos/curso-update.operation.ts @@ -1,7 +1,7 @@ import { CursoUpdateDeclaration } from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractObjectUuidBase, ValidationContractUuid, createDtoOperationOptions, createValidationContract } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { CursoFindOneByIdInputValidationContract, CursoFindOneResultDto } from './curso-find-one.operation'; import { CursoInputDtoValidationContract } from './curso-input.operation'; import { CursoDto } from './curso.dto'; diff --git a/src/application/business/ensino/curso/dtos/curso.dto.ts b/src/application/business/ensino/curso/dtos/curso.dto.ts index dfd66789..f2264158 100644 --- a/src/application/business/ensino/curso/dtos/curso.dto.ts +++ b/src/application/business/ensino/curso/dtos/curso.dto.ts @@ -1,13 +1,11 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { createValidationContract } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ====================================================== -export const CursoDtoValidationContract = createValidationContract(() => { - return new Spec.CursoValidationContract().yupSchema(Spec.extendYup(yup)); -}); +export const CursoDtoValidationContract = createValidationContract(() => Spec.GetSchema(Spec.CursoValidator, yup)); // ====================================================== export const CursoDto = createEntityDtoClass(Spec.CursoDeclarationFactory); diff --git a/src/application/business/ensino/diario-professor/diario-professor.controller.ts b/src/application/business/ensino/diario-professor/diario-professor.controller.ts index 1c305daa..857f3051 100644 --- a/src/application/business/ensino/diario-professor/diario-professor.controller.ts +++ b/src/application/business/ensino/diario-professor/diario-professor.controller.ts @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Patch, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/src/application/business/ensino/diario-professor/diario-professor.resolver.ts b/src/application/business/ensino/diario-professor/diario-professor.resolver.ts index f6de7841..f2cbb3f0 100644 --- a/src/application/business/ensino/diario-professor/diario-professor.resolver.ts +++ b/src/application/business/ensino/diario-professor/diario-professor.resolver.ts @@ -1,6 +1,6 @@ import { Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { DiarioProfessorService } from './diario-professor.service'; diff --git a/src/application/business/ensino/diario-professor/diario-professor.service.ts b/src/application/business/ensino/diario-professor/diario-professor.service.ts index e09b11a3..db17d3df 100644 --- a/src/application/business/ensino/diario-professor/diario-professor.service.ts +++ b/src/application/business/ensino/diario-professor/diario-professor.service.ts @@ -3,7 +3,7 @@ import * as Dtos from '@sisgea/spec'; import { has, map, pick } from 'lodash'; import { paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { DiarioProfessorEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/ensino/diario_professor.entity'; diff --git a/src/application/business/ensino/diario-professor/dtos/diario-professor-create.operation.ts b/src/application/business/ensino/diario-professor/dtos/diario-professor-create.operation.ts index e8925d8b..44a8b6eb 100644 --- a/src/application/business/ensino/diario-professor/dtos/diario-professor-create.operation.ts +++ b/src/application/business/ensino/diario-professor/dtos/diario-professor-create.operation.ts @@ -1,4 +1,4 @@ -import { createDtoOperationOptions } from 'infrastructure'; +import { createDtoOperationOptions } from '../../../../../infrastructure'; import { DiarioProfessorFindOneResultDto } from './diario-professor-find-one.operation'; import { DiarioProfessorInputDto, DiarioProfessorInputDtoValidationContract } from './diario-professor-input.operation'; import { DiarioProfessorDto } from './diario-professor.dto'; diff --git a/src/application/business/ensino/diario/diario.controller.ts b/src/application/business/ensino/diario/diario.controller.ts index f0008b40..729b5234 100644 --- a/src/application/business/ensino/diario/diario.controller.ts +++ b/src/application/business/ensino/diario/diario.controller.ts @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Patch, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/src/application/business/ensino/diario/diario.resolver.ts b/src/application/business/ensino/diario/diario.resolver.ts index 18a382d9..e7d3b5bd 100644 --- a/src/application/business/ensino/diario/diario.resolver.ts +++ b/src/application/business/ensino/diario/diario.resolver.ts @@ -1,6 +1,6 @@ import { Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { DiarioService } from './diario.service'; diff --git a/src/application/business/ensino/diario/diario.service.ts b/src/application/business/ensino/diario/diario.service.ts index c064acc5..3b1417d2 100644 --- a/src/application/business/ensino/diario/diario.service.ts +++ b/src/application/business/ensino/diario/diario.service.ts @@ -3,7 +3,7 @@ import * as Dtos from '@sisgea/spec'; import { has, map, pick } from 'lodash'; import { FilterOperator, paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { DiarioEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/ensino/diario.entity'; diff --git a/src/application/business/ensino/diario/dtos/diario-create.operation.ts b/src/application/business/ensino/diario/dtos/diario-create.operation.ts index 1d77bc3e..3777b7ce 100644 --- a/src/application/business/ensino/diario/dtos/diario-create.operation.ts +++ b/src/application/business/ensino/diario/dtos/diario-create.operation.ts @@ -1,5 +1,5 @@ -import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from 'infrastructure'; import * as yup from 'yup'; +import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from '../../../../../infrastructure'; import { DiarioFindOneResultDto } from './diario-find-one.operation'; import { DiarioInputDto, DiarioInputDtoValidationContract } from './diario-input.operation'; import { DiarioDto } from './diario.dto'; diff --git a/src/application/business/ensino/disciplina/disciplina.controller.ts b/src/application/business/ensino/disciplina/disciplina.controller.ts index 4c131edd..1631bb22 100644 --- a/src/application/business/ensino/disciplina/disciplina.controller.ts +++ b/src/application/business/ensino/disciplina/disciplina.controller.ts @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Param, ParseUUIDPipe, Patch, Post, Put, Upload import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/src/application/business/ensino/disciplina/disciplina.resolver.ts b/src/application/business/ensino/disciplina/disciplina.resolver.ts index ac474fcf..43edd132 100644 --- a/src/application/business/ensino/disciplina/disciplina.resolver.ts +++ b/src/application/business/ensino/disciplina/disciplina.resolver.ts @@ -1,6 +1,6 @@ import { Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { DisciplinaService } from './disciplina.service'; diff --git a/src/application/business/ensino/disciplina/disciplina.service.ts b/src/application/business/ensino/disciplina/disciplina.service.ts index c36f8aa7..ac4f3f56 100644 --- a/src/application/business/ensino/disciplina/disciplina.service.ts +++ b/src/application/business/ensino/disciplina/disciplina.service.ts @@ -4,7 +4,7 @@ import { AppResource, AppResourceView } from 'application/utils/qbEfficientLoad' import { map, pick } from 'lodash'; import { paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { DisciplinaEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/ensino/disciplina.entity'; diff --git a/src/application/business/ensino/disciplina/dtos/disciplina-create.operation.ts b/src/application/business/ensino/disciplina/dtos/disciplina-create.operation.ts index 40d46cf5..b84c0c01 100644 --- a/src/application/business/ensino/disciplina/dtos/disciplina-create.operation.ts +++ b/src/application/business/ensino/disciplina/dtos/disciplina-create.operation.ts @@ -1,6 +1,6 @@ // ====================================================== -import { createDtoOperationOptions } from 'infrastructure'; +import { createDtoOperationOptions } from '../../../../../infrastructure'; import { DisciplinaFindOneResultDto } from './disciplina-find-one.operation'; import { DisciplinaInputDto, DisciplinaInputDtoValidationContract } from './disciplina-input.operation'; import { DisciplinaDto } from './disciplina.dto'; diff --git a/src/application/business/ensino/modalidade/dtos/modalidade-create.operation.ts b/src/application/business/ensino/modalidade/dtos/modalidade-create.operation.ts index f15c96ed..e7e82900 100644 --- a/src/application/business/ensino/modalidade/dtos/modalidade-create.operation.ts +++ b/src/application/business/ensino/modalidade/dtos/modalidade-create.operation.ts @@ -1,6 +1,6 @@ // ====================================================== -import { createDtoOperationOptions } from 'infrastructure'; +import { createDtoOperationOptions } from '../../../../../infrastructure'; import { ModalidadeFindOneResultDto } from './modalidade-find-one.operation'; import { ModalidadeInputDto, ModalidadeInputDtoValidationContract } from './modalidade-input.operation'; import { ModalidadeDto } from './modalidade.dto'; diff --git a/src/application/business/ensino/modalidade/dtos/modalidade-delete-one.operation.ts b/src/application/business/ensino/modalidade/dtos/modalidade-delete-one.operation.ts index 87be600a..1c0bdfaa 100644 --- a/src/application/business/ensino/modalidade/dtos/modalidade-delete-one.operation.ts +++ b/src/application/business/ensino/modalidade/dtos/modalidade-delete-one.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractUuid, createDtoOperationOptions, createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { ModalidadeDtoValidationContract } from './modalidade.dto'; // ====================================================== diff --git a/src/application/business/ensino/modalidade/dtos/modalidade-find-all.operation.ts b/src/application/business/ensino/modalidade/dtos/modalidade-find-all.operation.ts index f78b8adc..57033ff1 100644 --- a/src/application/business/ensino/modalidade/dtos/modalidade-find-all.operation.ts +++ b/src/application/business/ensino/modalidade/dtos/modalidade-find-all.operation.ts @@ -1,6 +1,6 @@ import * as Spec from '@sisgea/spec'; import { SearchInputDto, SearchInputValidationContract, createDtoOperationOptions } from '../../../../../infrastructure'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ====================================================== diff --git a/src/application/business/ensino/modalidade/dtos/modalidade-find-one.operation.ts b/src/application/business/ensino/modalidade/dtos/modalidade-find-one.operation.ts index a70e000a..8a45de9d 100644 --- a/src/application/business/ensino/modalidade/dtos/modalidade-find-one.operation.ts +++ b/src/application/business/ensino/modalidade/dtos/modalidade-find-one.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractUuid, createDtoOperationOptions, createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { ModalidadeDto, ModalidadeDtoValidationContract } from './modalidade.dto'; // ====================================================== diff --git a/src/application/business/ensino/modalidade/dtos/modalidade-input.operation.ts b/src/application/business/ensino/modalidade/dtos/modalidade-input.operation.ts index 59d76fd8..6efdcb5d 100644 --- a/src/application/business/ensino/modalidade/dtos/modalidade-input.operation.ts +++ b/src/application/business/ensino/modalidade/dtos/modalidade-input.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { createValidationContract, getSchemaField } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { ModalidadeDtoValidationContract } from './modalidade.dto'; // ====================================================== diff --git a/src/application/business/ensino/modalidade/dtos/modalidade-update.operation.ts b/src/application/business/ensino/modalidade/dtos/modalidade-update.operation.ts index 0914c7c8..6028566b 100644 --- a/src/application/business/ensino/modalidade/dtos/modalidade-update.operation.ts +++ b/src/application/business/ensino/modalidade/dtos/modalidade-update.operation.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractUuid, createDtoOperationOptions, createValidationContract } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; import { ModalidadeFindOneByIdInputValidationContract, ModalidadeFindOneResultDto } from './modalidade-find-one.operation'; import { ModalidadeInputDtoValidationContract } from './modalidade-input.operation'; import { ModalidadeDto } from './modalidade.dto'; diff --git a/src/application/business/ensino/modalidade/dtos/modalidade.dto.ts b/src/application/business/ensino/modalidade/dtos/modalidade.dto.ts index 9074fd13..c4f50a00 100644 --- a/src/application/business/ensino/modalidade/dtos/modalidade.dto.ts +++ b/src/application/business/ensino/modalidade/dtos/modalidade.dto.ts @@ -1,7 +1,7 @@ import * as Spec from '@sisgea/spec'; -import { createEntityDtoClass } from 'infrastructure/utils/createDtoClass'; import * as yup from 'yup'; import { ValidationContractString, ValidationContractUuid, createValidationContract } from '../../../../../infrastructure'; +import { createEntityDtoClass } from '../../../../../infrastructure/utils/createDtoClass'; // ====================================================== diff --git a/src/application/business/ensino/modalidade/modalidade.controller.ts b/src/application/business/ensino/modalidade/modalidade.controller.ts index eb141d7a..668d2968 100644 --- a/src/application/business/ensino/modalidade/modalidade.controller.ts +++ b/src/application/business/ensino/modalidade/modalidade.controller.ts @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Patch, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/src/application/business/ensino/modalidade/modalidade.resolver.ts b/src/application/business/ensino/modalidade/modalidade.resolver.ts index e3e6f134..e7e042a7 100644 --- a/src/application/business/ensino/modalidade/modalidade.resolver.ts +++ b/src/application/business/ensino/modalidade/modalidade.resolver.ts @@ -1,8 +1,8 @@ import { Info, Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; -import { GraphQLResolveInfo } from 'graphql'; +import type { GraphQLResolveInfo } from 'graphql'; import getFieldNames from 'graphql-list-fields'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { ModalidadeOperations } from './dtos'; diff --git a/src/application/business/ensino/modalidade/modalidade.service.ts b/src/application/business/ensino/modalidade/modalidade.service.ts index 890df739..9a5551d2 100644 --- a/src/application/business/ensino/modalidade/modalidade.service.ts +++ b/src/application/business/ensino/modalidade/modalidade.service.ts @@ -3,7 +3,7 @@ import * as Dtos from '@sisgea/spec'; import { AppResource, AppResourceView } from 'application/utils/qbEfficientLoad'; import { map, pick } from 'lodash'; import { paginate } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { ModalidadeEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/ensino/modalidade.entity'; diff --git a/src/application/business/ensino/turma/dtos/turma-create.operation.ts b/src/application/business/ensino/turma/dtos/turma-create.operation.ts index 92ec3bfc..8da1890a 100644 --- a/src/application/business/ensino/turma/dtos/turma-create.operation.ts +++ b/src/application/business/ensino/turma/dtos/turma-create.operation.ts @@ -1,5 +1,5 @@ -import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from 'infrastructure'; import * as yup from 'yup'; +import { ValidationContractObjectUuidBase, createDtoOperationOptions, createValidationContract } from '../../../../../infrastructure'; import { TurmaFindOneResultDto } from './turma-find-one.operation'; import { TurmaInputDto, TurmaInputDtoValidationContract } from './turma-input.operation'; import { TurmaDto } from './turma.dto'; diff --git a/src/application/business/ensino/turma/turma.controller.ts b/src/application/business/ensino/turma/turma.controller.ts index 029807e1..fab70bf9 100644 --- a/src/application/business/ensino/turma/turma.controller.ts +++ b/src/application/business/ensino/turma/turma.controller.ts @@ -2,7 +2,7 @@ import { Controller, Delete, Get, Param, ParseUUIDPipe, Patch, Post, Put, Upload import { ApiTags } from '@nestjs/swagger'; import * as Dto from '@sisgea/spec'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationCreate, diff --git a/src/application/business/ensino/turma/turma.resolver.ts b/src/application/business/ensino/turma/turma.resolver.ts index 7f678af9..94244d8f 100644 --- a/src/application/business/ensino/turma/turma.resolver.ts +++ b/src/application/business/ensino/turma/turma.resolver.ts @@ -1,6 +1,6 @@ import { Resolver } from '@nestjs/graphql'; import * as Dto from '@sisgea/spec'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoGraphQl, DtoOperationGqlMutation, DtoOperationGqlQuery } from '../../../../infrastructure'; import { GqlDtoInput } from '../../../../infrastructure/api-documentate/GqlDtoInput'; import { TurmaOperations } from './dtos'; diff --git a/src/application/business/ensino/turma/turma.service.ts b/src/application/business/ensino/turma/turma.service.ts index 297d384b..98391a07 100644 --- a/src/application/business/ensino/turma/turma.service.ts +++ b/src/application/business/ensino/turma/turma.service.ts @@ -4,7 +4,7 @@ import { AppResource, AppResourceView } from 'application/utils/qbEfficientLoad' import { has, map, pick } from 'lodash'; import { FilterOperator, paginate } from 'nestjs-paginate'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../../../../domain'; +import type { IContextoDeAcesso } from '../../../../domain'; import { getPaginateQueryFromSearchInput, getPaginatedResultDto } from '../../../../infrastructure'; import { DatabaseContextService } from '../../../../infrastructure/integrate-database/database-context/database-context.service'; import { TurmaEntity } from '../../../../infrastructure/integrate-database/typeorm/entities/ensino/turma.entity'; diff --git a/src/application/utils/qbEfficientLoad.ts b/src/application/utils/qbEfficientLoad.ts index dbb79f2e..9168b1e6 100644 --- a/src/application/utils/qbEfficientLoad.ts +++ b/src/application/utils/qbEfficientLoad.ts @@ -13,24 +13,24 @@ export enum AppResource { type ILoadStrategy = { resource: string | AppResource; - declarationFactory: Spec.IDeclaredEntity; + declarationFactory: Spec.IDeclarator; allowedProperties: string[]; }; const loadStrategies: ILoadStrategy[] = [ { resource: AppResource.ARQUIVO, - declarationFactory: Spec.ArquivoDeclarationFactory, + declarationFactory: Spec.Arquivo, allowedProperties: ['id', 'nome', 'mimeType', 'sizeBytes', 'dateCreated', 'dateUpdated', 'dateDeleted'], }, { resource: AppResource.IMAGEM, - declarationFactory: Spec.ImagemDeclarationFactory, + declarationFactory: Spec.Imagem, allowedProperties: ['id', 'descricao', 'imagemArquivo', 'dateCreated', 'dateUpdated', 'dateDeleted'], }, { resource: AppResource.IMAGEM_ARQUIVO, - declarationFactory: Spec.ImagemArquivoDeclarationFactory, + declarationFactory: Spec.ImagemArquivo, allowedProperties: ['id', 'largura', 'altura', 'formato', 'mimeType', 'arquivo', 'dateCreated'], }, { diff --git a/src/domain/authorization/IBaseAuthz.ts b/src/domain/authorization/IBaseAuthz.ts index 2ddc66f1..62a8dd9f 100644 --- a/src/domain/authorization/IBaseAuthz.ts +++ b/src/domain/authorization/IBaseAuthz.ts @@ -1,6 +1,6 @@ import { Promisable } from 'type-fest'; import { SelectQueryBuilder } from 'typeorm'; -import { IContextoDeAcesso } from '../contexto-de-acesso'; +import type { IContextoDeAcesso } from '../contexto-de-acesso'; // diff --git a/src/infrastructure/contexto-de-acesso/core/ContextoDeAcesso.ts b/src/infrastructure/contexto-de-acesso/core/ContextoDeAcesso.ts index 53054e9c..091e20e2 100644 --- a/src/infrastructure/contexto-de-acesso/core/ContextoDeAcesso.ts +++ b/src/infrastructure/contexto-de-acesso/core/ContextoDeAcesso.ts @@ -4,7 +4,7 @@ import { SelectQueryBuilder } from 'typeorm'; import { AuthzPolicyPublic } from '../../../application/authorization-policies/00-AuthzPolicyPublic'; import { IAuthzStatement, IAuthzStatementFilter } from '../../../application/authorization-policies/statements/IAuthzStatement'; import { IBaseAuthzFilterFn, IBaseAuthzStatementContext } from '../../../domain'; -import { IContextoDeAcesso } from '../../../domain/contexto-de-acesso/IContextoDeAcesso'; +import type { IContextoDeAcesso } from '../../../domain/contexto-de-acesso/IContextoDeAcesso'; import { ICurrentUsuario } from '../../authentication/interfaces'; import { DatabaseContextService } from '../../integrate-database'; diff --git a/src/infrastructure/environment-config/environment-config.service.ts b/src/infrastructure/environment-config/environment-config.service.ts index 3e6ae314..c220fbb8 100644 --- a/src/infrastructure/environment-config/environment-config.service.ts +++ b/src/infrastructure/environment-config/environment-config.service.ts @@ -1,9 +1,11 @@ import { Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; +import { __dirname } from 'infrastructure/utils/dirname'; import { join } from 'path'; import { DataSourceOptions } from 'typeorm'; import { IConfig } from '../../domain'; import { IConfigIntegrateAuthKeycloakCredentials, IConfigIntegrateAuthOidcClientCredentials } from '../../domain/config/IConfigIntegrateAuth'; +import * as entities from '../integrate-database/typeorm/entities'; @Injectable() export class EnvironmentConfigService implements IConfig { @@ -187,8 +189,9 @@ export class EnvironmentConfigService implements IConfig { getTypeOrmAppDataSourceOptions(): DataSourceOptions { const options = { ...this.getTypeOrmSharedDataSourceOptions(), - entities: [`${this.getTypeOrmPathEntities()}/**/*{.ts,.js}`], - subscribers: [`${this.getTypeOrmPathSubscribers()}/**/*{.ts,.js}`], + entities: [...Object.values(entities)], + // entities: [`${this.getTypeOrmPathEntities()}/**/*{.ts,.js}`], + // subscribers: [`${this.getTypeOrmPathSubscribers()}/**/*{.ts,.js}`], }; return options as DataSourceOptions; diff --git a/src/infrastructure/integrate-database/typeorm/entities/ambientes/index.ts b/src/infrastructure/integrate-database/typeorm/entities/ambientes/index.ts new file mode 100644 index 00000000..9f0a63fb --- /dev/null +++ b/src/infrastructure/integrate-database/typeorm/entities/ambientes/index.ts @@ -0,0 +1,7 @@ +export * from './ambiente.entity'; +export * from './bloco.entity'; +export * from './campus.entity'; +export * from './cidade.entity'; +export * from './endereco.entity'; +export * from './estado.entity'; +export * from './reserva.entity'; diff --git a/src/infrastructure/integrate-database/typeorm/entities/autenticacao/index.ts b/src/infrastructure/integrate-database/typeorm/entities/autenticacao/index.ts new file mode 100644 index 00000000..6ebeb309 --- /dev/null +++ b/src/infrastructure/integrate-database/typeorm/entities/autenticacao/index.ts @@ -0,0 +1,2 @@ +export * from './usuario-vinculo-campus.entity'; +export * from './usuario.entity'; diff --git a/src/infrastructure/integrate-database/typeorm/entities/base/index.ts b/src/infrastructure/integrate-database/typeorm/entities/base/index.ts new file mode 100644 index 00000000..afaa7b73 --- /dev/null +++ b/src/infrastructure/integrate-database/typeorm/entities/base/index.ts @@ -0,0 +1,3 @@ +export * from './arquivo.entity'; +export * from './imagem.entity'; +export * from './imagem_arquivo.entity'; diff --git a/src/infrastructure/integrate-database/typeorm/entities/calendario/index.ts b/src/infrastructure/integrate-database/typeorm/entities/calendario/index.ts new file mode 100644 index 00000000..90450f22 --- /dev/null +++ b/src/infrastructure/integrate-database/typeorm/entities/calendario/index.ts @@ -0,0 +1 @@ +export * from './calendario-letivo.entity'; diff --git a/src/infrastructure/integrate-database/typeorm/entities/ensino/index.ts b/src/infrastructure/integrate-database/typeorm/entities/ensino/index.ts new file mode 100644 index 00000000..08f508e4 --- /dev/null +++ b/src/infrastructure/integrate-database/typeorm/entities/ensino/index.ts @@ -0,0 +1,7 @@ +export * from './campus_possui_modalidade.entity'; +export * from './curso.entity'; +export * from './diario.entity'; +export * from './diario_professor.entity'; +export * from './disciplina.entity'; +export * from './modalidade.entity'; +export * from './turma.entity'; diff --git a/src/infrastructure/integrate-database/typeorm/entities/index.ts b/src/infrastructure/integrate-database/typeorm/entities/index.ts new file mode 100644 index 00000000..c0848184 --- /dev/null +++ b/src/infrastructure/integrate-database/typeorm/entities/index.ts @@ -0,0 +1,5 @@ +export * from './ambientes'; +export * from './autenticacao'; +export * from './base'; +export * from './calendario'; +export * from './ensino'; diff --git a/src/infrastructure/integrate-database/typeorm/entities/usuario-vinculo-campus/usuario-vinculo-campus.entity.ts b/src/infrastructure/integrate-database/typeorm/entities/usuario-vinculo-campus/usuario-vinculo-campus.entity.ts deleted file mode 100644 index 30b3ce6b..00000000 --- a/src/infrastructure/integrate-database/typeorm/entities/usuario-vinculo-campus/usuario-vinculo-campus.entity.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { IEntityDate, IUsuarioVinculoCampusModel } from '@sisgea/spec'; -import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; -import { CampusEntity } from '../ambientes/campus.entity'; -import { UsuarioEntity } from '../autenticacao/usuario.entity'; - -@Entity('usuario_vinculo_campus') -export class UsuarioVinculoCampusEntity implements IUsuarioVinculoCampusModel { - @PrimaryGeneratedColumn('uuid') - id!: string; - - // - - @Column({ name: 'ativo', type: 'boolean' }) - ativo!: boolean; - - @Column({ name: 'cargo', type: 'text' }) - cargo!: string; - - // - - @ManyToOne(() => CampusEntity, (campus) => campus.vinculos) - @JoinColumn({ name: 'id_campus_fk' }) - campus!: CampusEntity; - - @ManyToOne(() => UsuarioEntity, (usuario) => usuario.vinculos) - @JoinColumn({ name: 'id_usuario_fk' }) - usuario!: UsuarioEntity; - - // - - @Column({ name: 'date_created', type: 'timestamptz', nullable: false }) - dateCreated!: IEntityDate; - - @Column({ name: 'date_updated', type: 'timestamptz', nullable: false }) - dateUpdated!: IEntityDate; - - @Column({ name: 'date_deleted', type: 'timestamptz', nullable: true }) - dateDeleted!: null | IEntityDate; -} diff --git a/src/infrastructure/utils/createDtoClass.ts b/src/infrastructure/utils/createDtoClass.ts index c687bfd5..4d6ca75b 100644 --- a/src/infrastructure/utils/createDtoClass.ts +++ b/src/infrastructure/utils/createDtoClass.ts @@ -1,16 +1,12 @@ import { InputType, Int, ObjectType } from '@nestjs/graphql'; import * as Spec from '@sisgea/spec'; import { __decorate, __metadata } from 'tslib'; -import { DtoProperty, IDtoPropertyOptions } from '../api-documentate'; +import * as yup from 'yup'; +import { DtoProperty, IDtoOperationOptions, IDtoPropertyOptions } from '../api-documentate'; const rootDtoClassesMap = new Map(); -export const createEntityDtoClass = Spec.IEntityDeclarationRaw>( - factory: Factory, - mode: Spec.IOutputDeclarationMode = 'output', - dtoClassesMap = rootDtoClassesMap, - parent = '', -) => { +export const createEntityDtoClass = Spec.IDeclaration>(factory: Factory, mode: Spec.IOutputDeclarationMode = 'output', dtoClassesMap = rootDtoClassesMap, parent = '') => { const declaration = factory(); let dtoClassName = declaration.name; @@ -52,11 +48,11 @@ export const createEntityDtoClass = Spec.IEntityDeclarati for (const propertyKey in declaration.properties) { const declarationRaw = declaration.properties[propertyKey]; - let declarationTarget: Spec.IEntityDeclarationRawPropertySimple | null = null; + let declarationTarget: Spec.IDeclarationPropertySimple | null = null; switch (declarationRaw.type) { case Spec.PropertyTypes.MIXED: { - const declarationRawMixed = declarationRaw as Spec.IEntityDeclarationRawPropertyMixed; + const declarationRawMixed = declarationRaw as Spec.IDeclarationPropertyMixed; if (mode === Spec.OutputDeclarationModes.INPUT) { declarationTarget = declarationRawMixed.input; @@ -70,7 +66,7 @@ export const createEntityDtoClass = Spec.IEntityDeclarati } default: { - declarationTarget = declarationRaw as Spec.IEntityDeclarationRawPropertySimple; + declarationTarget = declarationRaw as Spec.IDeclarationPropertySimple; break; } } @@ -192,3 +188,65 @@ export const createEntityDtoClass = Spec.IEntityDeclarati return decoratedClass; }; + +export const createOperationOptionsFromOperator = (operation: Spec.IOperation) => { + const operationOptions: IDtoOperationOptions = { + description: operation.description, + + gql: null, + swagger: { + returnType: { + schema: { + type: 'string', + format: 'binary', + nullable: false, + }, + }, + params: [], + queries: [], + }, + }; + + if (operation.input) { + if (operation.input.strategy === 'dto') { + for (const [name, config] of Object.entries(operation.input.params ?? [])) { + operationOptions.swagger.params ||= []; + + if (config.type !== 'mixed' && typeof config.type === 'string') { + const configSimple = config as Spec.IDeclarationPropertySimple; + + operationOptions.swagger.params.push({ + name, + description: configSimple.description, + required: configSimple.required !== false, + validationContract: () => Spec.GetSchema(Spec.GetPropertyValidator(configSimple), yup), + }); + } + } + + for (const [name, config] of Object.entries(operation.input.query ?? [])) { + operationOptions.swagger.queries ||= []; + + if (config.type !== 'mixed' && typeof config.type === 'string') { + const configSimple = config as Spec.IDeclarationPropertySimple; + + operationOptions.swagger.queries.push({ + name, + validationContract: () => Spec.GetSchema(Spec.GetPropertyValidator(configSimple), yup), + description: configSimple.description, + required: configSimple.required !== false, + }); + } + } + } + } + + if (operation.output.strategy === 'file') { + operationOptions.meta ||= {}; + operationOptions.meta.getFile ||= { + mimeType: 'application/octet-stream', + }; + } + + return operationOptions; +}; diff --git a/src/infrastructure/utils/dirname.ts b/src/infrastructure/utils/dirname.ts new file mode 100644 index 00000000..e23ee5bb --- /dev/null +++ b/src/infrastructure/utils/dirname.ts @@ -0,0 +1,5 @@ +const g = globalThis.__dirname; +export const __dirname = g; + +// export const __filename = fileURLToPath(import.meta.url); +// export const __dirname = dirname(__filename); diff --git a/src/infrastructure/validation/yup/ValidationPipeYup.ts b/src/infrastructure/validation/yup/ValidationPipeYup.ts index a74570b4..2c61b637 100644 --- a/src/infrastructure/validation/yup/ValidationPipeYup.ts +++ b/src/infrastructure/validation/yup/ValidationPipeYup.ts @@ -1,5 +1,6 @@ import { Injectable, PipeTransform } from '@nestjs/common'; import omit from 'lodash/omit'; +import type { ISchema } from 'yup'; import * as yup from 'yup'; import { ValidationFailedException } from '../../adapters/common/ValidationFailedException'; import { tryCast } from './tryCast'; @@ -12,7 +13,7 @@ interface ValidationPipeYupOptions { @Injectable() export class ValidationPipeYup implements PipeTransform { constructor( - private yupSchema: yup.ISchema, + private yupSchema: ISchema, private options: ValidationPipeYupOptions, ) {} diff --git a/src/main.ts b/src/main.ts index abdc70ad..c3db5fcf 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,10 +1,11 @@ import { NestFactory } from '@nestjs/core'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import compression from 'compression'; +import helmet from 'helmet'; +import 'reflect-metadata'; import { AppModule } from './application/app.module'; import { IConfig } from './domain'; import { EnvironmentConfigService } from './infrastructure/environment-config'; -import { getModuleHelmet } from './infrastructure/utils/modules/helmet/modules.helmet'; function setupSwaggerConfig(configService: IConfig | null = null) { const config = new DocumentBuilder(); @@ -51,9 +52,7 @@ function setupSwaggerConfig(configService: IConfig | null = null) { return config; } -async function bootstrap() { - // - +async function setupApp() { const app = await NestFactory.create(AppModule); const environmentConfigService = app.get(EnvironmentConfigService); @@ -62,11 +61,6 @@ async function bootstrap() { const isProduction = environmentConfigService.getRuntimeIsProduction(); - const port = environmentConfigService.getRuntimePort(); - // - - const helmet = await getModuleHelmet(); - app.use( helmet({ contentSecurityPolicy: isProduction ? undefined : false, @@ -75,11 +69,9 @@ async function bootstrap() { ); // - app.use(compression()); // - const config = setupSwaggerConfig(environmentConfigService); const document = SwaggerModule.createDocument(app, config.build()); @@ -93,6 +85,14 @@ async function bootstrap() { app.enableCors(); + return app; +} + +async function bootstrap() { + // + const app = await setupApp(); + const environmentConfigService = app.get(EnvironmentConfigService); + const port = environmentConfigService.getRuntimePort(); await app.listen(port); } diff --git a/tsconfig.json b/tsconfig.json index a0a9824b..858c11b4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,22 +1,25 @@ { "compilerOptions": { "strict": true, - "module": "Node16", "lib": ["esnext"], - "moduleResolution": "node", + "target": "ES2019", + "module": "CommonJS", "resolveJsonModule": true, "declaration": true, "removeComments": true, "strictNullChecks": true, + "isolatedModules": true, "emitDecoratorMetadata": true, "esModuleInterop": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, - "target": "es2017", "sourceMap": true, "outDir": "./dist", "baseUrl": "./src", + "paths": { + "@/*": ["./*"] + }, "incremental": true, "skipLibCheck": true - }, + } }