add slug to catalogue
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
import { IsString, IsOptional, IsBoolean, IsInt, Min, IsEnum } from 'class-validator';
|
import { IsString, IsEnum, Matches } from 'class-validator';
|
||||||
import { ApiPropertyOptional, ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Type } from 'class-transformer';
|
|
||||||
import { CatalogueSize } from '../enums/company-status.enum';
|
import { CatalogueSize } from '../enums/company-status.enum';
|
||||||
|
|
||||||
export class CreateCatalogueDto {
|
export class CreateCatalogueDto {
|
||||||
@@ -9,6 +8,12 @@ export class CreateCatalogueDto {
|
|||||||
@ApiProperty({ example: 'ایرانی' })
|
@ApiProperty({ example: 'ایرانی' })
|
||||||
name: string;
|
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()
|
@IsString()
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ export class Catalogue extends BaseEntity {
|
|||||||
@Property({ type: "varchar", length: 255})
|
@Property({ type: "varchar", length: 255})
|
||||||
name!: string;
|
name!: string;
|
||||||
|
|
||||||
|
@Property({ type: "varchar", length: 255, nullable: false })
|
||||||
|
slug!: string;
|
||||||
|
|
||||||
@Property({ type: "json" })
|
@Property({ type: "json" })
|
||||||
content!: string;
|
content!: string;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user