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