feat: add booking description field to item model and database
parent
ffc75ba174
commit
6a7ab72e12
|
@ -0,0 +1,19 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
|
|
||||||
|
export class AddBookingDescriptionToItem1749537252986
|
||||||
|
implements MigrationInterface
|
||||||
|
{
|
||||||
|
name = 'AddBookingDescriptionToItem1749537252986';
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "items" ADD "booking_description" text`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "items" DROP COLUMN "booking_description"`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,9 @@ export class ItemModel
|
||||||
@Column('varchar', { name: 'name', unique: true })
|
@Column('varchar', { name: 'name', unique: true })
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
|
@Column('text', { name: 'booking_description', nullable: true })
|
||||||
|
booking_description: string;
|
||||||
|
|
||||||
@Column('varchar', { name: 'image_url', nullable: true })
|
@Column('varchar', { name: 'image_url', nullable: true })
|
||||||
image_url: string;
|
image_url: string;
|
||||||
|
|
||||||
|
|
|
@ -18,4 +18,5 @@ export interface ItemEntity extends BaseStatusEntity {
|
||||||
use_queue: boolean;
|
use_queue: boolean;
|
||||||
show_to_booking: boolean;
|
show_to_booking: boolean;
|
||||||
breakdown_bundling?: boolean;
|
breakdown_bundling?: boolean;
|
||||||
|
booking_description?: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ export class DetailItemManager extends BaseDetailManager<ItemEntity> {
|
||||||
`${this.tableName}.show_to_booking`,
|
`${this.tableName}.show_to_booking`,
|
||||||
`${this.tableName}.breakdown_bundling`,
|
`${this.tableName}.breakdown_bundling`,
|
||||||
`${this.tableName}.play_estimation`,
|
`${this.tableName}.play_estimation`,
|
||||||
|
`${this.tableName}.booking_description`,
|
||||||
|
|
||||||
`item_category.id`,
|
`item_category.id`,
|
||||||
`item_category.name`,
|
`item_category.name`,
|
||||||
|
|
|
@ -54,6 +54,7 @@ export class IndexItemManager extends BaseIndexManager<ItemEntity> {
|
||||||
`${this.tableName}.breakdown_bundling`,
|
`${this.tableName}.breakdown_bundling`,
|
||||||
`${this.tableName}.play_estimation`,
|
`${this.tableName}.play_estimation`,
|
||||||
`${this.tableName}.show_to_booking`,
|
`${this.tableName}.show_to_booking`,
|
||||||
|
`${this.tableName}.booking_description`,
|
||||||
|
|
||||||
`item_category.id`,
|
`item_category.id`,
|
||||||
`item_category.name`,
|
`item_category.name`,
|
||||||
|
|
|
@ -138,6 +138,17 @@ export class ItemDto extends BaseStatusDto implements ItemEntity {
|
||||||
@ValidateIf((body) => body.show_to_booking)
|
@ValidateIf((body) => body.show_to_booking)
|
||||||
show_to_booking: boolean;
|
show_to_booking: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
example: '...',
|
||||||
|
})
|
||||||
|
@ValidateIf((body) => body.show_to_booking)
|
||||||
|
@IsString({
|
||||||
|
message: 'Booking description is required when show to booking is enabled.',
|
||||||
|
})
|
||||||
|
booking_description: string;
|
||||||
|
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
name: 'bundling_items',
|
name: 'bundling_items',
|
||||||
type: [Object],
|
type: [Object],
|
||||||
|
|
Loading…
Reference in New Issue