feat: add information to queue item for display
parent
fb7f925c78
commit
86c73058fd
|
@ -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"`,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -13,6 +13,9 @@ export class ItemQueueModel
|
|||
@Column('varchar', { name: 'name' })
|
||||
name: string;
|
||||
|
||||
@Column('varchar', { name: 'information', nullable: true })
|
||||
information: string;
|
||||
|
||||
@Column('enum', {
|
||||
name: 'item_type',
|
||||
enum: ItemType,
|
||||
|
|
|
@ -5,5 +5,6 @@ import { ItemEntity } from 'src/modules/item-related/item/domain/entities/item.e
|
|||
export interface ItemQueueEntity extends BaseStatusEntity {
|
||||
name: string;
|
||||
item_type: ItemType;
|
||||
information?: string;
|
||||
items: ItemEntity[];
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ export class DetailItemQueueManager extends BaseDetailManager<ItemQueueEntity> {
|
|||
`${this.tableName}.id`,
|
||||
`${this.tableName}.status`,
|
||||
`${this.tableName}.name`,
|
||||
`${this.tableName}.information`,
|
||||
`${this.tableName}.item_type`,
|
||||
`${this.tableName}.created_at`,
|
||||
`${this.tableName}.creator_name`,
|
||||
|
@ -47,6 +48,7 @@ export class DetailItemQueueManager extends BaseDetailManager<ItemQueueEntity> {
|
|||
`items.base_price`,
|
||||
`items.share_profit`,
|
||||
`items.play_estimation`,
|
||||
`items.video_url`,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -55,4 +57,12 @@ export class DetailItemQueueManager extends BaseDetailManager<ItemQueueEntity> {
|
|||
id: this.dataId,
|
||||
};
|
||||
}
|
||||
|
||||
getResult(): ItemQueueEntity {
|
||||
const videos = this.result.items.map((item) => {
|
||||
return item.video_url ?? [];
|
||||
});
|
||||
this.result['videos'] = videos.flat();
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,14 @@ export class ItemQueueDto extends BaseStatusDto implements ItemQueueEntity {
|
|||
@IsString()
|
||||
name: string;
|
||||
|
||||
@ApiProperty({
|
||||
name: 'information',
|
||||
required: false,
|
||||
example: 'Running text untuk display antrian',
|
||||
})
|
||||
@IsString()
|
||||
information: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: 'string',
|
||||
required: true,
|
||||
|
|
|
@ -40,4 +40,10 @@ export class ItemQueueReadController {
|
|||
async detail(@Param('id') id: string): Promise<ItemQueueEntity> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue