Compare commits
No commits in common. "development" and "1.6.23-alpha.3" have entirely different histories.
developmen
...
1.6.23-alp
|
@ -55,7 +55,7 @@ export class ValidateRelationHelper<Entity> {
|
|||
const relationColumn =
|
||||
data[relation.relation]?.[`${relation.singleQuery[0]}`];
|
||||
if (
|
||||
// !!relationColumn &&
|
||||
!!relationColumn &&
|
||||
this.mappingValidator(
|
||||
relationColumn,
|
||||
relation.singleQuery[1],
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class RemoveItemNameUnique1750834308368 implements MigrationInterface {
|
||||
name = 'RemoveItemNameUnique1750834308368';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" DROP CONSTRAINT "UQ_213736582899b3599acaade2cd1"`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" ADD CONSTRAINT "UQ_213736582899b3599acaade2cd1" UNIQUE ("name")`,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -43,7 +43,7 @@ export class BookingItemManager extends IndexItemManager {
|
|||
const hasRates = (this.filterParam.season_period_ids?.length ?? 0) > 0;
|
||||
const items = data.map((item) => {
|
||||
const currentRate = item.item_rates.find((rate) =>
|
||||
this.filterParam.season_period_ids?.includes(rate.season_period_id),
|
||||
this.filterParam.season_period_ids.includes(rate.season_period_id),
|
||||
);
|
||||
const { item_rates, ...rest } = item;
|
||||
const rate = currentRate?.['price'] ?? rest.base_price;
|
||||
|
@ -54,14 +54,4 @@ export class BookingItemManager extends IndexItemManager {
|
|||
});
|
||||
return { total, data: items };
|
||||
}
|
||||
|
||||
setQueryFilter(
|
||||
queryBuilder: SelectQueryBuilder<ItemEntity>,
|
||||
): SelectQueryBuilder<ItemEntity> {
|
||||
const query = super.setQueryFilter(queryBuilder);
|
||||
|
||||
query.andWhere(`${this.tableName}.status = 'active'`);
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ export class CreateBookingManager extends CreateTransactionManager {
|
|||
time: this.data.booking_date,
|
||||
id: this.data.id,
|
||||
},
|
||||
this.data.payment_total,
|
||||
`snap/v4/redirection/${this.data.payment_midtrans_token}`,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ export class ItemController {
|
|||
): Promise<PaginationResponse<ItemEntity>> {
|
||||
params.limit = 1000;
|
||||
params.show_to_booking = true;
|
||||
params.all_item = true;
|
||||
this.indexManager.setFilterParam(params);
|
||||
this.indexManager.setService(this.serviceData, TABLE_NAME.ITEM);
|
||||
await this.indexManager.execute();
|
||||
|
|
|
@ -25,7 +25,7 @@ export class ItemModel
|
|||
extends BaseStatusModel<ItemEntity>
|
||||
implements ItemEntity
|
||||
{
|
||||
@Column('varchar', { name: 'name' })
|
||||
@Column('varchar', { name: 'name', unique: true })
|
||||
name: string;
|
||||
|
||||
@Column('text', { name: 'booking_description', nullable: true })
|
||||
|
|
|
@ -8,7 +8,6 @@ import { ItemEntity } from '../../entities/item.entity';
|
|||
import { ItemModel } from '../../../data/models/item.model';
|
||||
import { BaseCreateManager } from 'src/core/modules/domain/usecase/managers/base-create.manager';
|
||||
import { ItemCreatedEvent } from '../../entities/event/item-created.event';
|
||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||
|
||||
@Injectable()
|
||||
export class CreateItemManager extends BaseCreateManager<ItemEntity> {
|
||||
|
@ -30,37 +29,11 @@ export class CreateItemManager extends BaseCreateManager<ItemEntity> {
|
|||
}
|
||||
|
||||
get validateRelations(): validateRelations[] {
|
||||
const timeGroupId = this.data.time_group_id ?? this.data.time_group?.id;
|
||||
const relation =
|
||||
this.data.bundling_items?.length > 0
|
||||
? 'bundling_items'
|
||||
: 'bundling_parents';
|
||||
return timeGroupId != null
|
||||
? [
|
||||
{
|
||||
relation: relation,
|
||||
singleQuery: ['time_group_id', '!=', timeGroupId],
|
||||
message: `Gagal Update! Time group item dan bundling item tidak sama`,
|
||||
},
|
||||
]
|
||||
: [];
|
||||
return [];
|
||||
}
|
||||
|
||||
get uniqueColumns(): columnUniques[] {
|
||||
const timeGroupId = this.data.time_group_id ?? this.data.time_group?.id;
|
||||
return timeGroupId != null
|
||||
? [
|
||||
{
|
||||
column: 'name',
|
||||
query: `(status = '${STATUS.ACTIVE}' AND (${this.tableName}.time_group_id Is Null OR ${this.tableName}.time_group_id = '${timeGroupId}'))`,
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
column: 'name',
|
||||
query: `(status = '${STATUS.ACTIVE}')`,
|
||||
},
|
||||
];
|
||||
return [{ column: 'name' }];
|
||||
}
|
||||
|
||||
get eventTopics(): EventTopics[] {
|
||||
|
|
|
@ -8,7 +8,6 @@ import {
|
|||
columnUniques,
|
||||
validateRelations,
|
||||
} from 'src/core/strings/constants/interface.constants';
|
||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||
|
||||
@Injectable()
|
||||
export class UpdateItemManager extends BaseUpdateManager<ItemEntity> {
|
||||
|
@ -40,31 +39,11 @@ export class UpdateItemManager extends BaseUpdateManager<ItemEntity> {
|
|||
}
|
||||
|
||||
get validateRelations(): validateRelations[] {
|
||||
const timeGroupId = this.data.time_group_id ?? this.data.time_group?.id;
|
||||
const relation =
|
||||
this.data.bundling_items?.length > 0
|
||||
? 'bundling_items'
|
||||
: 'bundling_parents';
|
||||
|
||||
return timeGroupId != null
|
||||
? [
|
||||
{
|
||||
relation: relation,
|
||||
singleQuery: ['time_group_id', '!=', timeGroupId],
|
||||
message: `Gagal Update! Time group item dan bundling item tidak sama`,
|
||||
},
|
||||
]
|
||||
: [];
|
||||
return [];
|
||||
}
|
||||
|
||||
get uniqueColumns(): columnUniques[] {
|
||||
const timeGroupId = this.data.time_group_id ?? this.data.time_group?.id;
|
||||
return [
|
||||
{
|
||||
column: 'name',
|
||||
query: `(status = '${STATUS.ACTIVE}' AND (${this.tableName}.time_group_id Is Null OR ${this.tableName}.time_group_id = '${timeGroupId}'))`,
|
||||
},
|
||||
];
|
||||
return [];
|
||||
}
|
||||
|
||||
get entityTarget(): any {
|
||||
|
|
|
@ -6,8 +6,6 @@ import {
|
|||
Param,
|
||||
RelationParam,
|
||||
} from 'src/core/modules/domain/entities/base-filter.entity';
|
||||
import * as moment from 'moment';
|
||||
import { ORDER_TYPE } from 'src/core/strings/constants/base.constants';
|
||||
|
||||
// TODO:
|
||||
// Implementasikan filter by start_time, end_timen, dan max_usage_time
|
||||
|
@ -15,10 +13,6 @@ import { ORDER_TYPE } from 'src/core/strings/constants/base.constants';
|
|||
@Injectable()
|
||||
export class IndexPublicTimeGroupManager extends BaseIndexManager<TimeGroupEntity> {
|
||||
async prepareData(): Promise<void> {
|
||||
Object.assign(this.filterParam, {
|
||||
order_by: `${this.tableName}.start_time`,
|
||||
order_type: ORDER_TYPE.ASC,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -66,15 +60,6 @@ export class IndexPublicTimeGroupManager extends BaseIndexManager<TimeGroupEntit
|
|||
queryBuilder: SelectQueryBuilder<TimeGroupEntity>,
|
||||
): SelectQueryBuilder<TimeGroupEntity> {
|
||||
queryBuilder.andWhere(`items.id is not null`);
|
||||
|
||||
if (!this.filterParam.date) {
|
||||
const currentTime = moment().utcOffset('+07:00').format('HH:mm:ss');
|
||||
|
||||
queryBuilder.andWhere(`${this.tableName}.end_time >= :current_time`, {
|
||||
current_time: currentTime,
|
||||
});
|
||||
}
|
||||
|
||||
return queryBuilder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,12 +30,4 @@ export class FilterTimeGroupDto
|
|||
@ApiProperty({ type: 'string', required: false })
|
||||
@ValidateIf((body) => body.max_usage_time_to)
|
||||
max_usage_time_to: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: Date,
|
||||
required: false,
|
||||
example: '2024-01-01',
|
||||
})
|
||||
@ValidateIf((body) => body.date)
|
||||
date: Date;
|
||||
}
|
||||
|
|
|
@ -51,27 +51,27 @@ export class TicketDataService extends BaseDataService<QueueTicket> {
|
|||
],
|
||||
});
|
||||
|
||||
// if (!order) {
|
||||
// const { customer_name, customer_phone } =
|
||||
// await this.transaction.findOneOrFail({
|
||||
// where: {
|
||||
// id,
|
||||
// },
|
||||
// });
|
||||
if (!order) {
|
||||
const { customer_name, customer_phone } =
|
||||
await this.transaction.findOneOrFail({
|
||||
where: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
|
||||
// const start = moment().startOf('day').valueOf();
|
||||
// const end = moment().endOf('day').valueOf();
|
||||
// const order = this.order.findOneOrFail({
|
||||
// relations: ['tickets'],
|
||||
// where: {
|
||||
// customer: customer_name,
|
||||
// phone: customer_phone,
|
||||
// date: Between(start, end),
|
||||
// },
|
||||
// });
|
||||
const start = moment().startOf('day').valueOf();
|
||||
const end = moment().endOf('day').valueOf();
|
||||
const order = this.order.findOneOrFail({
|
||||
relations: ['tickets'],
|
||||
where: {
|
||||
customer: customer_name,
|
||||
phone: customer_phone,
|
||||
date: Between(start, end),
|
||||
},
|
||||
});
|
||||
|
||||
// return order;
|
||||
// }
|
||||
return order;
|
||||
}
|
||||
|
||||
return order;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ export class QueueOrchestrator {
|
|||
return order;
|
||||
} catch (error) {
|
||||
throw new UnauthorizedException({
|
||||
message: 'Invoice tidak ditemukan untuk tanggal hari ini',
|
||||
message: 'Invoice tidak ditemukan',
|
||||
error: 'INVOICE_NOT_FOUND',
|
||||
});
|
||||
}
|
||||
|
|
|
@ -324,23 +324,10 @@ export class WhatsappService {
|
|||
);
|
||||
}
|
||||
|
||||
async bookingRegister(
|
||||
data: WhatsappBookingCreate,
|
||||
total: number,
|
||||
paymentUrl: string,
|
||||
) {
|
||||
async bookingRegister(data: WhatsappBookingCreate, paymentUrl: string) {
|
||||
const momentDate = moment(data.time);
|
||||
const fallbackValue = momentDate.locale('id').format('dddd, DD MMMM YYYY');
|
||||
|
||||
const formattedTotal = new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR',
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 0,
|
||||
})
|
||||
.format(total)
|
||||
.replace('IDR', 'Rp');
|
||||
|
||||
const payload = {
|
||||
messaging_product: 'whatsapp',
|
||||
to: phoneNumberOnly(data.phone), // recipient's phone number
|
||||
|
@ -364,16 +351,6 @@ export class WhatsappService {
|
|||
parameter_name: 'booking_date',
|
||||
text: fallbackValue,
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
parameter_name: 'booking_code',
|
||||
text: data.code,
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
parameter_name: 'total',
|
||||
text: formattedTotal,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue