add slug to catalogue
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user