chore: add cover url field to the danak service entity
This commit is contained in:
@@ -195,6 +195,8 @@ export const enum ServiceMessage {
|
|||||||
REVIEW_STATUS_REQUIRED = "وضعیت نظر سرویس مورد نیاز است",
|
REVIEW_STATUS_REQUIRED = "وضعیت نظر سرویس مورد نیاز است",
|
||||||
SHOW_IN_SLIDER_REQUIRED = "وضعیت نمایش در اسلایدر سرویس مورد نیاز است",
|
SHOW_IN_SLIDER_REQUIRED = "وضعیت نمایش در اسلایدر سرویس مورد نیاز است",
|
||||||
SHOW_IN_SLIDER_BOOLEAN = "وضعیت نمایش در اسلایدر سرویس باید یک بولین باشد",
|
SHOW_IN_SLIDER_BOOLEAN = "وضعیت نمایش در اسلایدر سرویس باید یک بولین باشد",
|
||||||
|
COVER_URL_REQUIRED = "آدرس عکس کاور سرویس مورد نیاز است",
|
||||||
|
COVER_URL_SHOULD_BE_URL = "آدرس عکس کاور سرویس باید یک آدرس یو آر ال باشد",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum AnnouncementMessage {
|
export const enum AnnouncementMessage {
|
||||||
|
|||||||
@@ -97,4 +97,9 @@ export class CreateServiceDto {
|
|||||||
@IsString({ each: true })
|
@IsString({ each: true })
|
||||||
@ApiProperty({ description: "The images of the service", example: ["https://example.com/image1.png", "https://example.com/image2.png"] })
|
@ApiProperty({ description: "The images of the service", example: ["https://example.com/image1.png", "https://example.com/image2.png"] })
|
||||||
images: string[];
|
images: string[];
|
||||||
|
|
||||||
|
@IsNotEmpty({ message: ServiceMessage.COVER_URL_REQUIRED })
|
||||||
|
@IsUrl({ protocols: ["http", "https"], require_protocol: true }, { message: ServiceMessage.COVER_URL_SHOULD_BE_URL })
|
||||||
|
@ApiProperty({ description: "The cover url of the service", example: "https://example.com/cover.png" })
|
||||||
|
coverUrl: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ export class DanakService extends BaseEntity {
|
|||||||
@Column({ type: "varchar", length: 255, nullable: false })
|
@Column({ type: "varchar", length: 255, nullable: false })
|
||||||
icon: string;
|
icon: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
coverUrl: string;
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
@ManyToOne(() => DanakServiceCategory, (danakServiceCategory) => danakServiceCategory.danakServices, {
|
@ManyToOne(() => DanakServiceCategory, (danakServiceCategory) => danakServiceCategory.danakServices, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ export class DanakServicesService {
|
|||||||
async getDanakServicesSlider() {
|
async getDanakServicesSlider() {
|
||||||
const danakServices = await this.danakServicesRepository.find({
|
const danakServices = await this.danakServicesRepository.find({
|
||||||
where: { showInSlider: true, isActive: true, deletedAt: IsNull(), category: { isActive: true, deletedAt: IsNull() } },
|
where: { showInSlider: true, isActive: true, deletedAt: IsNull(), category: { isActive: true, deletedAt: IsNull() } },
|
||||||
relations: { category: true, images: true },
|
relations: { category: true },
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
name: true,
|
name: true,
|
||||||
@@ -394,15 +394,12 @@ export class DanakServicesService {
|
|||||||
isActive: true,
|
isActive: true,
|
||||||
isDanakSuggest: true,
|
isDanakSuggest: true,
|
||||||
showInSlider: true,
|
showInSlider: true,
|
||||||
|
coverUrl: true,
|
||||||
metaDescription: true,
|
metaDescription: true,
|
||||||
category: {
|
category: {
|
||||||
id: true,
|
id: true,
|
||||||
title: true,
|
title: true,
|
||||||
},
|
},
|
||||||
images: {
|
|
||||||
id: true,
|
|
||||||
imageUrl: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
order: { createdAt: "DESC" },
|
order: { createdAt: "DESC" },
|
||||||
withDeleted: false,
|
withDeleted: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user