feat: add max peak level and call prepare call time to item queue
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

pull/115/head 1.3.0-alpha.1
shancheas 2024-12-03 11:21:44 +07:00
parent d71c2096b8
commit 5f6214eeb6
6 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,25 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class ItemQueueAddTimeAndPeakLevel1733199330134
implements MigrationInterface
{
name = 'ItemQueueAddTimeAndPeakLevel1733199330134';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "item_queues" ADD "max_peak_level" integer NOT NULL DEFAULT '100'`,
);
await queryRunner.query(
`ALTER TABLE "item_queues" ADD "call_preparation" integer NOT NULL DEFAULT '5'`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "item_queues" DROP COLUMN "call_preparation"`,
);
await queryRunner.query(
`ALTER TABLE "item_queues" DROP COLUMN "max_peak_level"`,
);
}
}

View File

@ -10,6 +10,12 @@ export class ItemQueueModel
extends BaseStatusModel<ItemQueueEntity>
implements ItemQueueEntity
{
@Column('int', { default: 100 })
max_peak_level: number;
@Column('int', { default: 5 })
call_preparation: number;
@Column('varchar', { name: 'name' })
name: string;

View File

@ -6,5 +6,7 @@ export interface ItemQueueEntity extends BaseStatusEntity {
name: string;
item_type: ItemType;
information?: string;
max_peak_level: number;
call_preparation: number;
items: ItemEntity[];
}

View File

@ -36,6 +36,8 @@ export class DetailItemQueueManager extends BaseDetailManager<ItemQueueEntity> {
`${this.tableName}.creator_name`,
`${this.tableName}.updated_at`,
`${this.tableName}.editor_name`,
`${this.tableName}.max_peak_level`,
`${this.tableName}.call_preparation`,
`items.id`,
`items.created_at`,

View File

@ -39,6 +39,8 @@ export class IndexItemQueueManager extends BaseIndexManager<ItemQueueEntity> {
`${this.tableName}.creator_name`,
`${this.tableName}.updated_at`,
`${this.tableName}.editor_name`,
`${this.tableName}.max_peak_level`,
`${this.tableName}.call_preparation`,
`items.id`,
`items.created_at`,

View File

@ -1,12 +1,30 @@
import { BaseStatusDto } from 'src/core/modules/infrastructure/dto/base-status.dto';
import { ItemQueueEntity } from '../../domain/entities/item-queue.entity';
import { IsArray, IsString } from 'class-validator';
import { IsArray, IsNumber, IsString } from 'class-validator';
import { ItemType } from '../../constants';
import { ApiProperty } from '@nestjs/swagger';
import { ItemEntity } from 'src/modules/item-related/item/domain/entities/item.entity';
import { Exclude, Transform } from 'class-transformer';
export class ItemQueueDto extends BaseStatusDto implements ItemQueueEntity {
@ApiProperty({
name: 'max_peak_level',
required: false,
example: 'Menentukan level peak maksimal penuhnya wahana',
default: 100,
})
@IsNumber()
max_peak_level: number;
@ApiProperty({
name: 'call_preparation',
required: false,
example: 'Waktu persiapan untuk memanggil antrian dalam menit',
default: 5,
})
@IsNumber()
call_preparation: number;
@Exclude()
items: ItemEntity[];