Compare commits
No commits in common. "7e18580540a5ca3f8be3f5bb0a06deb836009659" and "b574d3a39d39b5c54b787dd61af6c912152c760a" have entirely different histories.
7e18580540
...
b574d3a39d
|
@ -6,7 +6,6 @@ import {
|
|||
RelationParam,
|
||||
} from 'src/core/modules/domain/entities/base-filter.entity';
|
||||
import { ItemEntity } from 'src/modules/item-related/item/domain/entities/item.entity';
|
||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||
|
||||
@Injectable()
|
||||
export class IndexItemRateManager extends BaseIndexManager<ItemEntity> {
|
||||
|
@ -28,7 +27,6 @@ export class IndexItemRateManager extends BaseIndexManager<ItemEntity> {
|
|||
) {
|
||||
const rate = item['item_rates']?.find(
|
||||
(rate) =>
|
||||
rate.season_period?.status == STATUS.ACTIVE &&
|
||||
d >= new Date(rate.season_period.start_date) &&
|
||||
d <= new Date(rate.season_period.end_date),
|
||||
);
|
||||
|
@ -86,7 +84,6 @@ export class IndexItemRateManager extends BaseIndexManager<ItemEntity> {
|
|||
'item_rates.price',
|
||||
|
||||
'season_period.id',
|
||||
'season_period.status',
|
||||
'season_period.holiday_name',
|
||||
'season_period.start_date',
|
||||
'season_period.end_date',
|
||||
|
|
|
@ -6,5 +6,4 @@ export interface FilterItemEntity extends BaseFilterEntity {
|
|||
limit_types: string[];
|
||||
tenant_ids: string[];
|
||||
all_item: boolean;
|
||||
season_period_ids: string[];
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import { ItemRateEntity } from 'src/modules/item-related/item-rate/domain/entiti
|
|||
@Injectable()
|
||||
export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
|
||||
async prepareData(): Promise<void> {
|
||||
this.filterParam.order_by = `season_period.id`;
|
||||
this.filterParam.order_by = `${this.tableName}.id`;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -38,11 +38,9 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
|
|||
get selects(): string[] {
|
||||
return [
|
||||
`${this.tableName}.id`,
|
||||
`${this.tableName}.item_id`,
|
||||
`${this.tableName}.price`,
|
||||
|
||||
`season_period.id`,
|
||||
`season_period.priority`,
|
||||
`season_period.created_at`,
|
||||
`season_period.creator_name`,
|
||||
`season_period.editor_name`,
|
||||
|
@ -70,24 +68,19 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
|
|||
itemIds: this.filterParam.item_ids,
|
||||
});
|
||||
}
|
||||
|
||||
if (this.filterParam.season_period_ids) {
|
||||
queryBuilder.andWhere(`season_period.id In (:...itemIds)`, {
|
||||
itemIds: this.filterParam.season_period_ids,
|
||||
});
|
||||
}
|
||||
|
||||
if (this.filterParam.start_date) {
|
||||
queryBuilder.andWhere(`season_period.start_date < :inputStartDate`, {
|
||||
inputStartDate: this.filterParam.end_date,
|
||||
});
|
||||
|
||||
queryBuilder.andWhere(`season_period.end_date > :inputEndDate`, {
|
||||
inputEndDate: this.filterParam.start_date,
|
||||
queryBuilder.andWhere(`season_period.start_date BETWEEN :from AND :to`, {
|
||||
from: this.filterParam.start_date,
|
||||
to: this.filterParam.end_date,
|
||||
});
|
||||
}
|
||||
|
||||
queryBuilder.addOrderBy('season_period.priority', 'ASC');
|
||||
if (this.filterParam.end_date) {
|
||||
queryBuilder.andWhere(`season_period.end_date BETWEEN :from AND :to`, {
|
||||
from: this.filterParam.start_date,
|
||||
to: this.filterParam.end_date,
|
||||
});
|
||||
}
|
||||
|
||||
return queryBuilder;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,6 @@ export class FilterItemDto extends BaseFilterDto implements FilterItemEntity {
|
|||
})
|
||||
item_categories: string[];
|
||||
|
||||
@ApiProperty({ type: ['string'], required: false })
|
||||
@Transform((body) => {
|
||||
return Array.isArray(body.value) ? body.value : [body.value];
|
||||
})
|
||||
season_period_ids: string[];
|
||||
|
||||
@ApiProperty({ type: ['string'], required: false })
|
||||
@Transform((body) => {
|
||||
return Array.isArray(body.value) ? body.value : [body.value];
|
||||
|
|
|
@ -45,7 +45,6 @@ export class CreateSeasonPeriodManager extends BaseCreateManager<SeasonPeriodEnt
|
|||
{
|
||||
topic: SeasonPeriodCreatedEvent,
|
||||
data: {
|
||||
id: this.result.id,
|
||||
...this.data,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -13,7 +13,6 @@ import {
|
|||
UnprocessableEntityException,
|
||||
} from '@nestjs/common';
|
||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||
import { TransactionPaymentType } from '../../../constants';
|
||||
|
||||
@Injectable()
|
||||
export class BatchConfirmDataTransactionManager extends BaseBatchUpdateStatusManager<TransactionEntity> {
|
||||
|
@ -30,10 +29,7 @@ export class BatchConfirmDataTransactionManager extends BaseBatchUpdateStatusMan
|
|||
|
||||
Object.assign(data, {
|
||||
status: STATUS.WAITING,
|
||||
reconciliation_status:
|
||||
data.payment_type == TransactionPaymentType.COUNTER
|
||||
? null
|
||||
: STATUS.PENDING,
|
||||
reconciliation_status: STATUS.PENDING,
|
||||
});
|
||||
|
||||
return;
|
||||
|
|
|
@ -12,7 +12,6 @@ import {
|
|||
import { TransactionModel } from '../../../data/models/transaction.model';
|
||||
import { TransactionChangeStatusEvent } from '../../entities/event/transaction-change-status.event';
|
||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||
import { TransactionPaymentType } from '../../../constants';
|
||||
|
||||
@Injectable()
|
||||
export class ConfirmDataTransactionManager extends BaseUpdateStatusManager<TransactionEntity> {
|
||||
|
@ -39,10 +38,7 @@ export class ConfirmDataTransactionManager extends BaseUpdateStatusManager<Trans
|
|||
|
||||
Object.assign(this.data, {
|
||||
status: STATUS.WAITING,
|
||||
reconciliation_status:
|
||||
this.oldData.payment_type == TransactionPaymentType.COUNTER
|
||||
? null
|
||||
: STATUS.PENDING,
|
||||
reconciliation_status: STATUS.PENDING,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue