Compare commits
2 Commits
1.6.25-alp
...
developmen
Author | SHA1 | Date |
---|---|---|
|
7bb539db0c | |
|
92b54635d0 |
|
@ -6,6 +6,8 @@ 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
|
||||
|
@ -13,6 +15,10 @@ import {
|
|||
@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;
|
||||
}
|
||||
|
||||
|
@ -60,6 +66,15 @@ 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,4 +30,12 @@ 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',
|
||||
message: 'Invoice tidak ditemukan untuk tanggal hari ini',
|
||||
error: 'INVOICE_NOT_FOUND',
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue