feat: add information to queue item for display
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

pull/115/head 1.2.3-alpha.1
shancheas 2024-11-14 15:05:39 +07:00
parent fb7f925c78
commit 86c73058fd
6 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,19 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddInformationToItemQueue1731570311609
implements MigrationInterface
{
name = 'AddInformationToItemQueue1731570311609';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "item_queues" ADD "information" character varying`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "item_queues" DROP COLUMN "information"`,
);
}
}

View File

@ -13,6 +13,9 @@ export class ItemQueueModel
@Column('varchar', { name: 'name' }) @Column('varchar', { name: 'name' })
name: string; name: string;
@Column('varchar', { name: 'information', nullable: true })
information: string;
@Column('enum', { @Column('enum', {
name: 'item_type', name: 'item_type',
enum: ItemType, enum: ItemType,

View File

@ -5,5 +5,6 @@ import { ItemEntity } from 'src/modules/item-related/item/domain/entities/item.e
export interface ItemQueueEntity extends BaseStatusEntity { export interface ItemQueueEntity extends BaseStatusEntity {
name: string; name: string;
item_type: ItemType; item_type: ItemType;
information?: string;
items: ItemEntity[]; items: ItemEntity[];
} }

View File

@ -30,6 +30,7 @@ export class DetailItemQueueManager extends BaseDetailManager<ItemQueueEntity> {
`${this.tableName}.id`, `${this.tableName}.id`,
`${this.tableName}.status`, `${this.tableName}.status`,
`${this.tableName}.name`, `${this.tableName}.name`,
`${this.tableName}.information`,
`${this.tableName}.item_type`, `${this.tableName}.item_type`,
`${this.tableName}.created_at`, `${this.tableName}.created_at`,
`${this.tableName}.creator_name`, `${this.tableName}.creator_name`,
@ -47,6 +48,7 @@ export class DetailItemQueueManager extends BaseDetailManager<ItemQueueEntity> {
`items.base_price`, `items.base_price`,
`items.share_profit`, `items.share_profit`,
`items.play_estimation`, `items.play_estimation`,
`items.video_url`,
]; ];
} }
@ -55,4 +57,12 @@ export class DetailItemQueueManager extends BaseDetailManager<ItemQueueEntity> {
id: this.dataId, id: this.dataId,
}; };
} }
getResult(): ItemQueueEntity {
const videos = this.result.items.map((item) => {
return item.video_url ?? [];
});
this.result['videos'] = videos.flat();
return this.result;
}
} }

View File

@ -14,6 +14,14 @@ export class ItemQueueDto extends BaseStatusDto implements ItemQueueEntity {
@IsString() @IsString()
name: string; name: string;
@ApiProperty({
name: 'information',
required: false,
example: 'Running text untuk display antrian',
})
@IsString()
information: string;
@ApiProperty({ @ApiProperty({
type: 'string', type: 'string',
required: true, required: true,

View File

@ -40,4 +40,10 @@ export class ItemQueueReadController {
async detail(@Param('id') id: string): Promise<ItemQueueEntity> { async detail(@Param('id') id: string): Promise<ItemQueueEntity> {
return await this.orchestrator.detail(id); return await this.orchestrator.detail(id);
} }
@Get('display/:id')
@Public(true)
async detailPublic(@Param('id') id: string): Promise<ItemQueueEntity> {
return await this.orchestrator.detail(id);
}
} }