user module
This commit is contained in:
@@ -233,10 +233,10 @@ export class PaymentsService {
|
||||
return payment;
|
||||
}
|
||||
|
||||
findAllPaymentsByRestaurantId(restId: string, userId: string) {
|
||||
findAllPaymentsBy(: string, userId: string) {
|
||||
return this.em.find(
|
||||
Payment,
|
||||
{ order: { restaurant: { id: restId }, user: { id: userId } } },
|
||||
{ order: { restaurant: { id: }, user: { id: userId } } },
|
||||
{ populate: ['order', 'order.paymentMethod'] },
|
||||
);
|
||||
}
|
||||
@@ -319,7 +319,7 @@ export class PaymentsService {
|
||||
return payment;
|
||||
}
|
||||
|
||||
async getChartData(dto: PaymentChartDto, restaurantId: string): Promise<Array<{ date: string; cash: number; online: number }>> {
|
||||
async getChartData(dto: PaymentChartDto, : string): Promise<Array<{ date: string; cash: number; online: number }>> {
|
||||
const { startDate, endDate, type = ChartPeriodEnum.Daily } = dto;
|
||||
|
||||
const start = startDate ? new Date(startDate) : new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);
|
||||
@@ -342,8 +342,8 @@ export class PaymentsService {
|
||||
const params: any[] = [startOfDay, endOfDay];
|
||||
let restaurantFilter = '';
|
||||
|
||||
if (restaurantId) {
|
||||
params.push(restaurantId);
|
||||
if () {
|
||||
params.push();
|
||||
restaurantFilter = `AND o.restaurant_id = ?`;
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ export class PaymentsService {
|
||||
ORDER BY DATE_TRUNC('${pgPeriod}', CAST(p.paid_at AS timestamp)) ASC
|
||||
`;
|
||||
|
||||
this.logger.debug(`Chart query params: startOfDay=${startOfDay.toISOString()}, endOfDay=${endOfDay.toISOString()}, restaurantId=${restaurantId}`);
|
||||
this.logger.debug(`Chart query params: startOfDay=${startOfDay.toISOString()}, endOfDay=${endOfDay.toISOString()}, =${}`);
|
||||
const result = await this.em.execute(query, params);
|
||||
this.logger.debug(`Chart query returned ${result.length} rows`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user