mirror of
https://github.com/PeterMaquiran/tvone-api.git
synced 2026-04-23 10:03:15 +00:00
add category swagger schema
This commit is contained in:
@@ -1,16 +1,33 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsOptional, IsString, IsUUID, MaxLength, MinLength } from 'class-validator';
|
||||
|
||||
export class CreateCategoryDto {
|
||||
@ApiProperty({
|
||||
example: 'Technology',
|
||||
description: 'Name of the category',
|
||||
minLength: 1,
|
||||
maxLength: 120,
|
||||
})
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(120)
|
||||
name: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 'technology',
|
||||
description: 'URL-friendly slug for the category',
|
||||
maxLength: 140,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(140)
|
||||
slug?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: '550e8400-e29b-41d4-a716-446655440000',
|
||||
description: 'Parent category UUID (if this is a sub-category)',
|
||||
nullable: true,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
parentId?: string | null;
|
||||
|
||||
@@ -1,17 +1,34 @@
|
||||
import { ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsOptional, IsString, IsUUID, MaxLength, MinLength } from 'class-validator';
|
||||
|
||||
export class UpdateCategoryDto {
|
||||
@ApiPropertyOptional({
|
||||
example: 'Technology',
|
||||
description: 'Name of the category',
|
||||
minLength: 1,
|
||||
maxLength: 120,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(120)
|
||||
name?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 'technology',
|
||||
description: 'URL-friendly slug for the category',
|
||||
maxLength: 140,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(140)
|
||||
slug?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: '550e8400-e29b-41d4-a716-446655440000',
|
||||
description: 'Parent category UUID (if this is a sub-category)',
|
||||
nullable: true,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
parentId?: string | null;
|
||||
|
||||
Reference in New Issue
Block a user