diff --git a/luna-backend/src/application/business/(spec)/base/arquivo/index.ts b/luna-backend/src/application/business/(spec)/base/arquivo/index.ts index 80dc7ad9..f110c013 100644 --- a/luna-backend/src/application/business/(spec)/base/arquivo/index.ts +++ b/luna-backend/src/application/business/(spec)/base/arquivo/index.ts @@ -1 +1,2 @@ export * from './IArquivoModel'; +export * from './operations'; diff --git a/luna-backend/src/application/business/(spec)/base/imagem-arquivo/index.ts b/luna-backend/src/application/business/(spec)/base/imagem-arquivo/index.ts index 9c9184f3..7d67bd7f 100644 --- a/luna-backend/src/application/business/(spec)/base/imagem-arquivo/index.ts +++ b/luna-backend/src/application/business/(spec)/base/imagem-arquivo/index.ts @@ -1 +1,2 @@ export * from './IImagemArquivoModel'; +export * from './operations'; diff --git a/luna-backend/src/application/business/(spec)/base/imagem/index.ts b/luna-backend/src/application/business/(spec)/base/imagem/index.ts index 2804c849..2f76509a 100644 --- a/luna-backend/src/application/business/(spec)/base/imagem/index.ts +++ b/luna-backend/src/application/business/(spec)/base/imagem/index.ts @@ -1 +1,2 @@ export * from './IImagemModel'; +export * from './operations'; diff --git a/luna-backend/src/application/business/ambientes/bloco/bloco.controller.ts b/luna-backend/src/application/business/ambientes/bloco/bloco.controller.ts index 4d659d10..4e0f176c 100644 --- a/luna-backend/src/application/business/ambientes/bloco/bloco.controller.ts +++ b/luna-backend/src/application/business/ambientes/bloco/bloco.controller.ts @@ -1,6 +1,6 @@ import { Controller, Delete, Get, Param, ParseUUIDPipe, Patch, Post, Put, UploadedFile, UseInterceptors } from '@nestjs/common'; import { FileInterceptor } from '@nestjs/platform-express'; -import { ApiBody, ApiConsumes, ApiTags } from '@nestjs/swagger'; +import { ApiBody, ApiConsumes, ApiProduces, ApiTags } from '@nestjs/swagger'; import { Paginate, PaginateQuery } from 'nestjs-paginate'; import * as Dto from '../../(spec)'; import { IContextoDeAcesso } from '../../../../domain'; @@ -44,6 +44,7 @@ export class BlocoController { } @Get('/:id/imagem/capa') + @ApiProduces('application/octet-stream', 'image/jpeg') @DtoOperationFindOne(BlocoOperations.BLOCO_GET_IMAGEM_CAPA) async blocoGetImagemCapa( @ContextoDeAcessoHttp() contextoDeAcesso: IContextoDeAcesso, diff --git a/luna-backend/src/application/business/ambientes/bloco/dtos/bloco-get-imagem-capa.operation.ts b/luna-backend/src/application/business/ambientes/bloco/dtos/bloco-get-imagem-capa.operation.ts index 04720d0c..0e9d780e 100644 --- a/luna-backend/src/application/business/ambientes/bloco/dtos/bloco-get-imagem-capa.operation.ts +++ b/luna-backend/src/application/business/ambientes/bloco/dtos/bloco-get-imagem-capa.operation.ts @@ -3,7 +3,7 @@ import { ValidationContractUuid, createDtoOperationOptions } from '../../../../. // ====================================================== export const BLOCO_GET_IMAGEM_CAPA = createDtoOperationOptions({ - description: 'Realiza a consulta a um bloco por ID.', + description: 'Obtêm a imagem de capa do bloco.', gql: null, diff --git a/luna-backend/src/application/business/ambientes/bloco/dtos/bloco.dto.ts b/luna-backend/src/application/business/ambientes/bloco/dtos/bloco.dto.ts index c952a3e6..328dea95 100644 --- a/luna-backend/src/application/business/ambientes/bloco/dtos/bloco.dto.ts +++ b/luna-backend/src/application/business/ambientes/bloco/dtos/bloco.dto.ts @@ -12,6 +12,7 @@ import { createDtoPropertyMap, createValidationContract, } from '../../../../../infrastructure'; +import { ImagemDto, ImagemFindOneResultDto } from '../../../base/imagem/dtos'; import { CampusDto, CampusFindOneResultDto } from '../../campus/dtos'; // ====================================================== @@ -81,6 +82,18 @@ export const BlocoDtoProperties = createDtoPropertyMap({ type: () => CampusFindOneResultDto, }, }, + + BLOCO_IMAGEM_CAPA_OUTPUT: { + nullable: true, + description: 'Imagem de capa do bloco.', + // + gql: { + type: () => ImagemDto, + }, + swagger: { + type: ImagemFindOneResultDto, + }, + }, }); // ====================================================== @@ -103,9 +116,11 @@ export class BlocoDto implements Dto.IBlocoModel { // - ambientes!: Dto.IAmbienteModel[]; + @DtoProperty(BlocoDtoProperties.BLOCO_IMAGEM_CAPA_OUTPUT) imagemCapa!: IImagemModel | null; + // + ambientes!: Dto.IAmbienteModel[]; // dateCreated!: Dto.IEntityDate; diff --git a/luna-backend/src/application/business/base/arquivo/arquivo.controller.ts b/luna-backend/src/application/business/base/arquivo/arquivo.controller.ts index 7717d4e5..d3c45d1e 100644 --- a/luna-backend/src/application/business/base/arquivo/arquivo.controller.ts +++ b/luna-backend/src/application/business/base/arquivo/arquivo.controller.ts @@ -1,5 +1,5 @@ import { Controller, Get, StreamableFile } from '@nestjs/common'; -import { ApiTags } from '@nestjs/swagger'; +import { ApiProduces, ApiTags } from '@nestjs/swagger'; import { IContextoDeAcesso } from '../../../../domain'; import { ContextoDeAcessoHttp, DtoOperationFindOne, HttpDtoParam } from '../../../../infrastructure'; import { HttpDtoQuery } from '../../../../infrastructure/api-documentate/HttpDtoQuery'; @@ -12,6 +12,7 @@ export class ArquivoController { constructor(private arquivoService: ArquivoService) {} @Get(':id') + @ApiProduces('application/octet-stream') @DtoOperationFindOne(ArquivoOperations.ARQUIVO_GET_FILE) async getFile( @ContextoDeAcessoHttp() contextoDeAcesso: IContextoDeAcesso, diff --git a/luna-backend/src/application/business/base/arquivo/dtos/arquivo-find-one.operation.ts b/luna-backend/src/application/business/base/arquivo/dtos/arquivo-find-one.operation.ts new file mode 100644 index 00000000..8bdab0d3 --- /dev/null +++ b/luna-backend/src/application/business/base/arquivo/dtos/arquivo-find-one.operation.ts @@ -0,0 +1,28 @@ +import { ObjectType } from '@nestjs/graphql'; +import * as Dto from '../../../(spec)'; +import { DtoProperty } from '../../../../../infrastructure'; +import { ArquivoDtoProperties } from './arquivo.dto'; + +// ====================================================== + +@ObjectType('ArquivoFindOneResultDto') +export class ArquivoFindOneResultDto implements Dto.IArquivoFindOneResultDto { + @DtoProperty(ArquivoDtoProperties.ARQUIVO_ID) + id!: string; + + // + + @DtoProperty(ArquivoDtoProperties.ARQUIVO_NOME) + nome!: string | null; + + @DtoProperty(ArquivoDtoProperties.ARQUIVO_MIME_TYPE) + mimeType!: string | null; + + @DtoProperty(ArquivoDtoProperties.ARQUIVO_SIZE_BYTES) + sizeBytes!: number | null; + + @DtoProperty(ArquivoDtoProperties.ARQUIVO_STORAGE_TYPE) + storageType!: string | null; +} + +// ====================================================== diff --git a/luna-backend/src/application/business/base/arquivo/dtos/arquivo-get-file.operation.ts b/luna-backend/src/application/business/base/arquivo/dtos/arquivo-get-file.operation.ts index 905578fc..44c4a868 100644 --- a/luna-backend/src/application/business/base/arquivo/dtos/arquivo-get-file.operation.ts +++ b/luna-backend/src/application/business/base/arquivo/dtos/arquivo-get-file.operation.ts @@ -9,7 +9,12 @@ export const ARQUIVO_GET_FILE = createDtoOperationOptions({ gql: null, swagger: { - returnType: '', + returnType: { + schema: { + type: 'string', + format: 'binary', + }, + }, params: [ { diff --git a/luna-backend/src/application/business/base/arquivo/dtos/arquivo.dto.ts b/luna-backend/src/application/business/base/arquivo/dtos/arquivo.dto.ts index 93e1df1a..aaec62f3 100644 --- a/luna-backend/src/application/business/base/arquivo/dtos/arquivo.dto.ts +++ b/luna-backend/src/application/business/base/arquivo/dtos/arquivo.dto.ts @@ -1,7 +1,9 @@ -import { Int, ObjectType } from '@nestjs/graphql'; +import { ObjectType } from '@nestjs/graphql'; import * as yup from 'yup'; import * as Dto from '../../../(spec)'; import { + CommonPropertyInteger, + CommonPropertyString, CommonPropertyUuid, DtoProperty, ValidationContractNumber, @@ -13,65 +15,52 @@ import { // ====================================================== -export const DisciplinaDtoValidationContract = createValidationContract(() => { +export const ArquivoDtoValidationContract = createValidationContract(() => { return yup.object({ id: ValidationContractUuid(), - // - - nome: ValidationContractString().required().nonNullable(), // disciplina - cargaHoraria: ValidationContractNumber().required().nonNullable().integer().moreThan(0), // disciplina - // + nome: ValidationContractString().nullable(), + mimeType: ValidationContractString().nullable(), + // + sizeBytes: ValidationContractNumber().integer().positive().required().nullable(), + storageType: ValidationContractString().nullable(), }); }); // ====================================================== -export const DisciplinaDtoProperties = createDtoPropertyMap({ - DISCIPLINA_ID: CommonPropertyUuid('ID de "disciplina"'), +export const ArquivoDtoProperties = createDtoPropertyMap({ + ARQUIVO_ID: CommonPropertyUuid('ID do arquivo'), // - DISCIPLINA_NOME: { - nullable: false, - description: 'Nome da disciplina.', - // - gql: { - type: () => String, - }, - swagger: { - type: 'string', - }, - }, - DISCIPLINA_CARGA_HORARIA: { - nullable: false, - description: 'Carga horária da disciplina.', - // - gql: { - type: () => Int, - }, - swagger: { - type: 'integer', - }, - }, - // + ARQUIVO_NOME: CommonPropertyString('Nome do arquivo', true), + ARQUIVO_MIME_TYPE: CommonPropertyString('Mime-type do arquivo', true), + ARQUIVO_SIZE_BYTES: CommonPropertyInteger('Tamanho do arquivo (em bytes)', true), + ARQUIVO_STORAGE_TYPE: CommonPropertyString('Estratégia de armazenamento do arquivo', true), }); // ====================================================== -@ObjectType('Disciplina') -export class DisciplinaDto implements Dto.IDisciplinaModel { - @DtoProperty(DisciplinaDtoProperties.DISCIPLINA_ID) +@ObjectType('Arquivo') +export class ArquivoDto implements Dto.IArquivoModel { + @DtoProperty(ArquivoDtoProperties.ARQUIVO_ID) id!: string; // - @DtoProperty(DisciplinaDtoProperties.DISCIPLINA_NOME) - nome!: string; + @DtoProperty(ArquivoDtoProperties.ARQUIVO_NOME) + nome!: string | null; + + @DtoProperty(ArquivoDtoProperties.ARQUIVO_MIME_TYPE) + mimeType!: string | null; + + @DtoProperty(ArquivoDtoProperties.ARQUIVO_SIZE_BYTES) + sizeBytes!: number | null; - @DtoProperty(DisciplinaDtoProperties.DISCIPLINA_CARGA_HORARIA) - cargaHoraria!: number; + @DtoProperty(ArquivoDtoProperties.ARQUIVO_STORAGE_TYPE) + storageType!: string | null; // diff --git a/luna-backend/src/application/business/base/base.module.ts b/luna-backend/src/application/business/base/base.module.ts index 34857384..b3c9cc2f 100644 --- a/luna-backend/src/application/business/base/base.module.ts +++ b/luna-backend/src/application/business/base/base.module.ts @@ -1,9 +1,10 @@ import { Module } from '@nestjs/common'; import { ArquivoModule } from './arquivo/arquivo.module'; +import { ImagemArquivoModule } from './imagem-arquivo/imagem-arquivo.module'; import { ImagemModule } from './imagem/imagem.module'; @Module({ - imports: [ImagemModule, ArquivoModule], + imports: [ImagemModule, ArquivoModule, ImagemArquivoModule], controllers: [], providers: [], exports: [], diff --git a/luna-backend/src/application/business/base/imagem-arquivo/dtos/imagem-arquivo-find-one.operation.ts b/luna-backend/src/application/business/base/imagem-arquivo/dtos/imagem-arquivo-find-one.operation.ts new file mode 100644 index 00000000..17be92f1 --- /dev/null +++ b/luna-backend/src/application/business/base/imagem-arquivo/dtos/imagem-arquivo-find-one.operation.ts @@ -0,0 +1,33 @@ +import { ObjectType } from '@nestjs/graphql'; +import * as Dto from '../../../(spec)'; +import { DtoProperty } from '../../../../../infrastructure'; +import { ImagemArquivoDtoProperties } from './imagem-arquivo.dto'; + +// ====================================================== + +@ObjectType('ImagemArquivoFindOneResultDto') +export class ImagemArquivoFindOneResultDto implements Dto.IImagemArquivoFindOneResultDto { + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_ID) + id!: string; + + // + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_LARGURA) + largura!: number; + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_ALTURA) + altura!: number; + // + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_FORMATO) + formato!: string; + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_MIME_TYPE) + mimeType!: string; + // + + // + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_IMAGEM_OUTPUT) + imagem!: Dto.IImagemModel; + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_ARQUIVO_OUTPUT) + arquivo!: Dto.IArquivoModel; + // +} + +// ====================================================== diff --git a/luna-backend/src/application/business/base/imagem-arquivo/dtos/imagem-arquivo.dto.ts b/luna-backend/src/application/business/base/imagem-arquivo/dtos/imagem-arquivo.dto.ts new file mode 100644 index 00000000..545a5a59 --- /dev/null +++ b/luna-backend/src/application/business/base/imagem-arquivo/dtos/imagem-arquivo.dto.ts @@ -0,0 +1,140 @@ +import { Int, ObjectType } from '@nestjs/graphql'; +import * as yup from 'yup'; +import * as Dto from '../../../(spec)'; +import { + CommonPropertyUuid, + DtoProperty, + ValidationContractNumber, + ValidationContractString, + ValidationContractUuid, + createDtoPropertyMap, + createValidationContract, +} from '../../../../../infrastructure'; +import { ArquivoDto } from '../../arquivo/dtos'; +import { ArquivoFindOneResultDto } from '../../arquivo/dtos/arquivo-find-one.operation'; +import { ImagemDto, ImagemFindOneResultDto } from '../../imagem/dtos'; + +// ====================================================== + +export const ImagemDtoValidationContract = createValidationContract(() => { + return yup.object({ + id: ValidationContractUuid(), + // + largura: ValidationContractNumber().integer().positive().required().nonNullable(), + altura: ValidationContractNumber().integer().positive().required().nonNullable(), + // + formato: ValidationContractString().required().nonNullable(), + mimeType: ValidationContractString().required().nonNullable(), + }); +}); + +// ====================================================== + +export const ImagemArquivoDtoProperties = createDtoPropertyMap({ + IMAGEM_ARQUIVO_ID: CommonPropertyUuid('ID do arquivo'), + + IMAGEM_ARQUIVO_LARGURA: { + nullable: false, + description: 'Largura da imagem.', + // + gql: { + type: () => Int, + }, + swagger: { + type: 'integer', + }, + }, + + IMAGEM_ARQUIVO_ALTURA: { + nullable: false, + description: 'Largura da imagem.', + // + gql: { + type: () => Int, + }, + swagger: { + type: 'integer', + }, + }, + + IMAGEM_ARQUIVO_FORMATO: { + nullable: false, + description: 'Formato da imagem.', + // + gql: { + type: () => String, + }, + swagger: { + type: 'string', + }, + }, + + IMAGEM_ARQUIVO_MIME_TYPE: { + nullable: false, + description: 'Formato da imagem.', + // + gql: { + type: () => String, + }, + swagger: { + type: 'string', + }, + }, + + IMAGEM_ARQUIVO_IMAGEM_OUTPUT: { + nullable: false, + description: 'Imagem.', + // + gql: { + type: () => ImagemDto, + }, + swagger: { + type: ImagemFindOneResultDto, + }, + }, + + IMAGEM_ARQUIVO_ARQUIVO_OUTPUT: { + nullable: false, + description: 'Arquivo.', + // + gql: { + type: () => ArquivoDto, + }, + swagger: { + type: ArquivoFindOneResultDto, + }, + }, +}); + +// ====================================================== + +@ObjectType('ImagemArquivo') +export class ImagemArquivoDto implements Dto.IImagemArquivoModel { + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_ID) + id!: string; + + // + + // + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_LARGURA) + largura!: number; + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_ALTURA) + altura!: number; + // + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_FORMATO) + formato!: string; + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_MIME_TYPE) + mimeType!: string; + // + + // + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_IMAGEM_OUTPUT) + imagem!: Dto.IImagemModel; + @DtoProperty(ImagemArquivoDtoProperties.IMAGEM_ARQUIVO_ARQUIVO_OUTPUT) + arquivo!: Dto.IArquivoModel; + // + + dateCreated!: Dto.IEntityDate; +} + +// ====================================================== diff --git a/luna-backend/src/application/business/base/imagem-arquivo/dtos/imagem-arquivo.operations.ts b/luna-backend/src/application/business/base/imagem-arquivo/dtos/imagem-arquivo.operations.ts new file mode 100644 index 00000000..a5d30554 --- /dev/null +++ b/luna-backend/src/application/business/base/imagem-arquivo/dtos/imagem-arquivo.operations.ts @@ -0,0 +1,3 @@ +export const ImagemArquivoOperations = { + // =============================== +}; diff --git a/luna-backend/src/application/business/base/imagem-arquivo/dtos/index.ts b/luna-backend/src/application/business/base/imagem-arquivo/dtos/index.ts new file mode 100644 index 00000000..01bde4ca --- /dev/null +++ b/luna-backend/src/application/business/base/imagem-arquivo/dtos/index.ts @@ -0,0 +1,3 @@ +export * from './imagem-arquivo.dto'; +export * from './imagem-arquivo-find-one.operation'; +export * from './imagem-arquivo.operations'; diff --git a/luna-backend/src/application/business/base/imagem-arquivo/imagem-arquivo.module.ts b/luna-backend/src/application/business/base/imagem-arquivo/imagem-arquivo.module.ts new file mode 100644 index 00000000..1d358a04 --- /dev/null +++ b/luna-backend/src/application/business/base/imagem-arquivo/imagem-arquivo.module.ts @@ -0,0 +1,10 @@ +import { Global, Module } from '@nestjs/common'; + +@Global() +@Module({ + imports: [], + controllers: [], + providers: [], + exports: [], +}) +export class ImagemArquivoModule {} diff --git a/luna-backend/src/application/business/base/imagem/dtos/imagem-find-one.operation.ts b/luna-backend/src/application/business/base/imagem/dtos/imagem-find-one.operation.ts new file mode 100644 index 00000000..597402dd --- /dev/null +++ b/luna-backend/src/application/business/base/imagem/dtos/imagem-find-one.operation.ts @@ -0,0 +1,23 @@ +import { ObjectType } from '@nestjs/graphql'; +import * as Dto from '../../../(spec)'; +import { IImagemArquivoFindOneResultDto } from '../../../(spec)/base/imagem-arquivo/operations'; +import { DtoProperty } from '../../../../../infrastructure'; +import { ImagemDtoProperties } from './imagem.dto'; + +// ====================================================== + +@ObjectType('ImagemFindOneResultDto') +export class ImagemFindOneResultDto implements Dto.IImagemFindOneResultDto { + @DtoProperty(ImagemDtoProperties.IMAGEM_ID) + id!: string; + + // + + @DtoProperty(ImagemDtoProperties.IMAGEM_DESCRICAO) + descricao!: string | null; + + @DtoProperty(ImagemDtoProperties.IMAGEM_IMAGEM_ARQUIVO_OUTPUT) + imagemArquivo!: Omit[]; +} + +// ====================================================== diff --git a/luna-backend/src/application/business/base/imagem/dtos/imagem.dto.ts b/luna-backend/src/application/business/base/imagem/dtos/imagem.dto.ts new file mode 100644 index 00000000..518da506 --- /dev/null +++ b/luna-backend/src/application/business/base/imagem/dtos/imagem.dto.ts @@ -0,0 +1,70 @@ +import { ObjectType } from '@nestjs/graphql'; +import * as yup from 'yup'; +import * as Dto from '../../../(spec)'; +import { IEntityDate } from '../../../(spec)'; +import { CommonPropertyUuid, DtoProperty, ValidationContractString, ValidationContractUuid, createDtoPropertyMap, createValidationContract } from '../../../../../infrastructure'; +import { ImagemArquivoDto, ImagemArquivoFindOneResultDto } from '../../imagem-arquivo/dtos'; + +// ====================================================== + +export const ImagemDtoValidationContract = createValidationContract(() => { + return yup.object({ + id: ValidationContractUuid(), + // + descricao: ValidationContractString().nullable(), + }); +}); + +// ====================================================== + +export const ImagemDtoProperties = createDtoPropertyMap({ + IMAGEM_ID: CommonPropertyUuid('ID da imagem'), + + IMAGEM_DESCRICAO: { + nullable: true, + description: 'Descrição da imagem.', + // + gql: { + type: () => String, + }, + swagger: { + type: 'string', + }, + }, + + IMAGEM_IMAGEM_ARQUIVO_OUTPUT: { + nullable: false, + description: 'Versões da imagem.', + // + gql: { + type: () => [ImagemArquivoDto], + }, + swagger: { + type: [ImagemArquivoFindOneResultDto], + }, + }, +}); + +// ====================================================== + +@ObjectType('Imagem') +export class ImagemDto implements Dto.IImagemModel { + @DtoProperty(ImagemDtoProperties.IMAGEM_ID) + id!: string; + + // + + @DtoProperty(ImagemDtoProperties.IMAGEM_DESCRICAO) + descricao!: string | null; + + @DtoProperty(ImagemDtoProperties.IMAGEM_IMAGEM_ARQUIVO_OUTPUT) + imagemArquivo!: Dto.IImagemArquivoModel[]; + + // + + dateCreated!: IEntityDate; + dateUpdated!: IEntityDate; + dateDeleted!: IEntityDate | null; +} + +// ====================================================== diff --git a/luna-backend/src/application/business/base/imagem/dtos/imagem.operations.ts b/luna-backend/src/application/business/base/imagem/dtos/imagem.operations.ts new file mode 100644 index 00000000..f01602d0 --- /dev/null +++ b/luna-backend/src/application/business/base/imagem/dtos/imagem.operations.ts @@ -0,0 +1,3 @@ +export const CampusOperations = { + // =============================== +}; diff --git a/luna-backend/src/application/business/base/imagem/dtos/index.ts b/luna-backend/src/application/business/base/imagem/dtos/index.ts new file mode 100644 index 00000000..3d6fac58 --- /dev/null +++ b/luna-backend/src/application/business/base/imagem/dtos/index.ts @@ -0,0 +1,3 @@ +export * from './imagem-find-one.operation'; +export * from './imagem.dto'; +export * from './imagem.operations'; diff --git a/luna-backend/src/infrastructure/common/CommonPropertyInteger.ts b/luna-backend/src/infrastructure/common/CommonPropertyInteger.ts new file mode 100644 index 00000000..918f907b --- /dev/null +++ b/luna-backend/src/infrastructure/common/CommonPropertyInteger.ts @@ -0,0 +1,18 @@ +import { Int } from '@nestjs/graphql'; +import { createDtoPropertyOptions } from '../api-documentate'; + +// ====================================================================== + +export const CommonPropertyInteger = (description: string, nullable: boolean) => + createDtoPropertyOptions({ + nullable: nullable, + description: description, + + gql: { + type: () => Int, + }, + + swagger: { + type: 'integer', + }, + }); diff --git a/luna-backend/src/infrastructure/common/CommonPropertyString.ts b/luna-backend/src/infrastructure/common/CommonPropertyString.ts new file mode 100644 index 00000000..d4c86d83 --- /dev/null +++ b/luna-backend/src/infrastructure/common/CommonPropertyString.ts @@ -0,0 +1,17 @@ +import { createDtoPropertyOptions } from '../api-documentate'; + +// ====================================================================== + +export const CommonPropertyString = (description: string, nullable: boolean) => + createDtoPropertyOptions({ + nullable: nullable, + description: description, + + gql: { + type: () => String, + }, + + swagger: { + type: 'string', + }, + }); diff --git a/luna-backend/src/infrastructure/common/index.ts b/luna-backend/src/infrastructure/common/index.ts index 69dda963..0d5b0561 100644 --- a/luna-backend/src/infrastructure/common/index.ts +++ b/luna-backend/src/infrastructure/common/index.ts @@ -1,4 +1,6 @@ export * from './CommonPropertyId'; +export * from './CommonPropertyInteger'; +export * from './CommonPropertyString'; export * from './CommonPropertyUuid'; -export * from './search-dto'; export * from './dtos'; +export * from './search-dto';