fix(SPG-595) Pemesanan - Penyesuaian flow booking

pull/27/head
Aswin Ashar Abdullah 2024-07-11 17:30:47 +07:00
parent eb32584205
commit de2041ae95
5 changed files with 24 additions and 10 deletions

View File

@ -72,8 +72,8 @@ export class CurrentSeasonPeriodManager extends BaseIndexManager<SeasonPeriodEnt
queryBuilder.andWhere( queryBuilder.andWhere(
`${this.tableName}.start_date BETWEEN :from AND :to`, `${this.tableName}.start_date BETWEEN :from AND :to`,
{ {
from: new Date().toLocaleDateString(), from: this.filterParam.date ?? new Date().toLocaleDateString(),
to: new Date().toLocaleDateString(), to: this.filterParam.date ?? new Date().toLocaleDateString(),
}, },
); );

View File

@ -39,8 +39,7 @@ export class SeasonPeriodReadOrchestrator extends BaseReadOrchestrator<SeasonPer
return this.detailManager.getResult(); return this.detailManager.getResult();
} }
async currentPeriod(): Promise<SeasonPeriodEntity> { async currentPeriod(params): Promise<SeasonPeriodEntity> {
const params = new FilterSeasonPeriodDto();
this.currentPeriodManager.setFilterParam(params); this.currentPeriodManager.setFilterParam(params);
this.currentPeriodManager.setService( this.currentPeriodManager.setService(
this.serviceData, this.serviceData,

View File

@ -0,0 +1,6 @@
import { ApiProperty } from '@nestjs/swagger';
export class FilterCurrentSeasonDto {
@ApiProperty({ type: Date, required: false, example: '2024-01-01' })
date: Date;
}

View File

@ -9,6 +9,7 @@ import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
import { Public } from 'src/core/guards'; import { Public } from 'src/core/guards';
import { ItemRateEntity } from 'src/modules/item-related/item-rate/domain/entities/item-rate.entity'; import { ItemRateEntity } from 'src/modules/item-related/item-rate/domain/entities/item-rate.entity';
import { FilterItemRateDto } from 'src/modules/item-related/item-rate/infrastructure/dto/filter-item-rate.dto'; import { FilterItemRateDto } from 'src/modules/item-related/item-rate/infrastructure/dto/filter-item-rate.dto';
import { FilterCurrentSeasonDto } from './dto/filter-current-season.dto';
@ApiTags(`${MODULE_NAME.SEASON_PERIOD.split('-').join(' ')} - read`) @ApiTags(`${MODULE_NAME.SEASON_PERIOD.split('-').join(' ')} - read`)
@Controller(`v1/${MODULE_NAME.SEASON_PERIOD}`) @Controller(`v1/${MODULE_NAME.SEASON_PERIOD}`)
@ -26,8 +27,10 @@ export class SeasonPeriodReadController {
} }
@Get('current-period') @Get('current-period')
async currentPeriod(): Promise<SeasonPeriodEntity> { async currentPeriod(
return await this.orchestrator.currentPeriod(); @Query() params: FilterCurrentSeasonDto,
): Promise<SeasonPeriodEntity> {
return await this.orchestrator.currentPeriod(params);
} }
@Get(':id') @Get(':id')

View File

@ -100,10 +100,16 @@ export function mappingRevertTransaction(data, type) {
season_period_name: data.season_period?.holiday_name ?? null, season_period_name: data.season_period?.holiday_name ?? null,
season_period_type_id: data.season_period?.season_type?.id ?? null, season_period_type_id: data.season_period?.season_type?.id ?? null,
season_period_type_name: data.season_period?.season_type?.name ?? null, season_period_type_name: data.season_period?.season_type?.name ?? null,
payment_type_method_id: data.payment_type_method?.id, payment_type_method_id:
payment_type_method_number: data.payment_type_method?.account_number, data.payment_type_method?.id ?? data.payment_type_bank?.id,
payment_type_method_name: data.payment_type_method?.issuer_name, payment_type_method_number:
payment_type_method_qr: data.payment_type_method?.qr_image, data.payment_type_method?.account_number ??
data.payment_type?.account_number,
payment_type_method_name:
data.payment_type_method?.issuer_name ??
data.payment_type_bank?.issuer_name,
payment_type_method_qr:
data.payment_type_method?.qr_image ?? data.payment_type_bank?.qr_image,
}); });
data.items?.map((item) => { data.items?.map((item) => {