feat: update subscription and service entities with enhancements
- Update message enum for better error handling - Enhance service creation DTO with new fields - Modify danak-service entity structure - Update subscription DTOs and entities - Improve user subscription entity model
This commit is contained in:
@@ -208,7 +208,10 @@ export const enum ServiceMessage {
|
||||
SERVICE_ALREADY_EXISTS_WITH_THIS_SLUG = "سرویسی با این اسلاگ قبلا ثبت شده است",
|
||||
PAGE_TITLE_REQUIRED = "عنوان صفحه سرویس مورد نیاز است",
|
||||
PAGE_TITLE_STRING = "عنوان صفحه سرویس باید یک رشته باشد",
|
||||
PAGE_TITLE_LENGTH = "عنوان صفحه سرویس باید بین ۳ تا ۱۵۰۰ کاراکتر باشد",
|
||||
PAGE_TITLE_LENGTH = "عنوان صفحه سرویس باید بین ۳ تا ۵۰۰ کاراکتر باشد",
|
||||
PAGE_DESCRIPTION_REQUIRED = "توضیحات صفحه سرویس مورد نیاز است",
|
||||
PAGE_DESCRIPTION_STRING = "توضیحات صفحه سرویس باید یک رشته باشد",
|
||||
PAGE_DESCRIPTION_LENGTH = "توضیحات صفحه سرویس باید بین ۱۰ تا ۵۰۰ کاراکتر باشد",
|
||||
}
|
||||
|
||||
export const enum AnnouncementMessage {
|
||||
|
||||
@@ -37,10 +37,17 @@ export class CreateServiceDto {
|
||||
@IsOptional()
|
||||
@IsNotEmpty({ message: ServiceMessage.PAGE_TITLE_REQUIRED })
|
||||
@IsString({ message: ServiceMessage.PAGE_TITLE_STRING })
|
||||
@Length(3, 1500, { message: ServiceMessage.PAGE_TITLE_LENGTH })
|
||||
@Length(3, 500, { message: ServiceMessage.PAGE_TITLE_LENGTH })
|
||||
@ApiProperty({ description: "The page title of the service", example: "Service Page Title" })
|
||||
pageTitle?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsNotEmpty({ message: ServiceMessage.PAGE_DESCRIPTION_REQUIRED })
|
||||
@IsString({ message: ServiceMessage.PAGE_DESCRIPTION_STRING })
|
||||
@Length(10, 500, { message: ServiceMessage.PAGE_DESCRIPTION_LENGTH })
|
||||
@ApiProperty({ description: "The page description of the service", example: "Service Page Description" })
|
||||
pageDescription?: string;
|
||||
|
||||
@IsNotEmpty({ message: ServiceMessage.DESCRIPTION_REQUIRED })
|
||||
@IsString({ message: ServiceMessage.DESCRIPTION_STRING })
|
||||
@Length(10, 500, { message: ServiceMessage.DESCRIPTION_LENGTH })
|
||||
|
||||
@@ -22,6 +22,9 @@ export class DanakService extends BaseEntity {
|
||||
@Column({ type: "text", nullable: true })
|
||||
pageTitle: string | null;
|
||||
|
||||
@Column({ type: "text", nullable: true })
|
||||
pageDescription: string | null;
|
||||
|
||||
@Column({ type: "varchar", length: 150, nullable: true, unique: true })
|
||||
@Index()
|
||||
slug: string | null;
|
||||
|
||||
@@ -15,11 +15,13 @@ export class SubscribeServiceDto {
|
||||
@ApiProperty({ description: "Name of business", example: "Test 1" })
|
||||
businessName: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsNotEmpty({ message: SubscriptionMessage.BUSINESS_PHONE_REQUIRED })
|
||||
@IsPhoneNumber("IR", { message: SubscriptionMessage.BUSINESS_PHONE_INVALID })
|
||||
@ApiProperty({ description: "Phone number of the business", example: "+98 234 567 8901", required: false })
|
||||
businessPhone: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsNotEmpty({ message: SubscriptionMessage.BUSINESS_DESCRIPTION_REQUIRED })
|
||||
@IsString({ message: SubscriptionMessage.BUSINESS_DESCRIPTION_STRING })
|
||||
@Length(5, 500, { message: SubscriptionMessage.BUSINESS_DESCRIPTION_LENGTH })
|
||||
|
||||
@@ -22,11 +22,11 @@ export class UserSubscription extends BaseEntity {
|
||||
@Column({ type: "varchar", length: 250, nullable: false })
|
||||
businessName: string;
|
||||
|
||||
@Column({ type: "varchar", length: 50, nullable: false })
|
||||
businessPhone: string;
|
||||
@Column({ type: "varchar", length: 50, nullable: true })
|
||||
businessPhone: string | null;
|
||||
|
||||
@Column({ type: "text", nullable: false })
|
||||
description: string;
|
||||
@Column({ type: "text", nullable: true })
|
||||
description: string | null;
|
||||
|
||||
@Column({ type: "varchar", length: 250, unique: true, nullable: true })
|
||||
slug: string;
|
||||
|
||||
Reference in New Issue
Block a user