Make slug optional on create and auto-generate from title when omitted

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-24 15:58:56 +03:30
co-authored by Cursor
parent aa990c3204
commit 1522ff62f5
9 changed files with 118 additions and 23 deletions
@@ -16,13 +16,14 @@ export class CreateBusinessDto {
@MaxLength(150)
title!: string;
@ApiProperty({ example: 'shine-carwash' })
@ApiPropertyOptional({ example: 'shine-carwash' })
@IsOptional()
@IsString()
@MaxLength(120)
@Matches(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, {
message: 'slug must be lowercase words separated by hyphens',
})
slug!: string;
slug?: string;
@ApiProperty({ format: 'uuid' })
@IsUUID()