add slug to catalogue

This commit is contained in:
2026-05-18 12:58:42 +03:30
parent dc15749c22
commit 3889ec19e3
2 changed files with 11 additions and 3 deletions
@@ -1,7 +1,6 @@
import { IsString, IsOptional, IsBoolean, IsInt, Min, IsEnum } from 'class-validator';
import { ApiPropertyOptional, ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsString, IsEnum, Matches } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { CatalogueSize } from '../enums/company-status.enum';
export class CreateCatalogueDto {
@@ -9,6 +8,12 @@ export class CreateCatalogueDto {
@ApiProperty({ example: 'ایرانی' })
name: string;
@IsString()
@Matches(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, {
message: 'Slug must contain only lowercase English letters, numbers, and hyphens',
})
@ApiProperty({ example: 'iranian-menu', description: 'URL-friendly slug (lowercase English letters, numbers, hyphens only)' })
slug: string;
@IsString()
@ApiProperty()
@@ -13,6 +13,9 @@ export class Catalogue extends BaseEntity {
@Property({ type: "varchar", length: 255})
name!: string;
@Property({ type: "varchar", length: 255, nullable: false })
slug!: string;
@Property({ type: "json" })
content!: string;