Skip to content

Commit

Permalink
Merge pull request #178 from tnramalho/feature/cache-swagger-updates
Browse files Browse the repository at this point in the history
chore: add swagger decorators
  • Loading branch information
MrMaz authored Jun 28, 2024
2 parents 054dcdc + faaf2fb commit cc20525
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/nestjs-cache/src/dto/cache.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Allow, IsOptional, IsString, ValidateNested } from 'class-validator';
import { ReferenceIdInterface } from '@concepta/ts-core';
import { CacheInterface } from '@concepta/ts-common';
import { CommonEntityDto, ReferenceIdDto } from '@concepta/nestjs-common';
import { ApiProperty } from '@nestjs/swagger';

/**
* Cache Create DTO
Expand All @@ -13,6 +14,10 @@ export class CacheDto extends CommonEntityDto implements CacheInterface {
* key
*/
@Expose()
@ApiProperty({
type: 'string',
description: 'key',
})
@IsString()
key = '';

Expand All @@ -21,13 +26,21 @@ export class CacheDto extends CommonEntityDto implements CacheInterface {
*/
@Expose()
@IsString()
@ApiProperty({
type: 'string',
description: 'data',
})
@IsOptional()
data!: string | null;

/**
* type
*/
@Expose()
@ApiProperty({
type: 'string',
description: 'type',
})
@IsString()
type = '';

Expand All @@ -38,6 +51,11 @@ export class CacheDto extends CommonEntityDto implements CacheInterface {
*/
@Expose()
@IsString()
@ApiProperty({
type: 'string',
description: 'type',
examples: ['60', '2 days', '10h', '7d'],
})
@IsOptional()
expiresIn!: string | null;

Expand All @@ -46,6 +64,10 @@ export class CacheDto extends CommonEntityDto implements CacheInterface {
*/
@Expose()
@Type(() => ReferenceIdDto)
@ApiProperty({
type: ReferenceIdDto,
description: 'assignee',
})
@ValidateNested()
assignee: ReferenceIdInterface = new ReferenceIdDto();

Expand Down

0 comments on commit cc20525

Please sign in to comment.