Some checks failed
Deploy Production / deploy (push) Failing after 5s
73 lines
1.5 KiB
TypeScript
73 lines
1.5 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import {
|
|
IsString,
|
|
IsNotEmpty,
|
|
IsOptional,
|
|
IsBoolean,
|
|
IsArray,
|
|
MaxLength,
|
|
MinLength,
|
|
} from 'class-validator';
|
|
|
|
export class CreateArticleDto {
|
|
@ApiProperty({
|
|
description: 'Article title',
|
|
example: 'Getting Started with NestJS',
|
|
minLength: 3,
|
|
maxLength: 200,
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@MinLength(3)
|
|
@MaxLength(200)
|
|
title: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Short preview/excerpt of the article (max 500 characters)',
|
|
example: 'Learn how to build scalable Node.js applications with NestJS framework...',
|
|
maxLength: 500,
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@MaxLength(500)
|
|
preview: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Full article content (Markdown supported)',
|
|
example: '# Introduction\n\nNestJS is a progressive Node.js framework...',
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
content: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Cover image URL',
|
|
example: 'https://example.com/images/nestjs-cover.jpg',
|
|
required: false,
|
|
})
|
|
@IsString()
|
|
@IsOptional()
|
|
coverImage?: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Article tags',
|
|
example: ['nestjs', 'nodejs', 'typescript'],
|
|
type: [String],
|
|
required: false,
|
|
})
|
|
@IsArray()
|
|
@IsString({ each: true })
|
|
@IsOptional()
|
|
tags?: string[];
|
|
|
|
@ApiProperty({
|
|
description: 'Whether the article is published immediately',
|
|
example: false,
|
|
default: false,
|
|
required: false,
|
|
})
|
|
@IsBoolean()
|
|
@IsOptional()
|
|
published?: boolean;
|
|
}
|