payment redirect
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { EntityManager, EntityRepository } from '@mikro-orm/postgresql';
|
||||
import { RestaurantPaymentMethod } from '../entities/restaurant-payment-method.entity';
|
||||
|
||||
@@ -7,4 +7,13 @@ export class RestaurantPaymentMethodRepository extends EntityRepository<Restaura
|
||||
constructor(readonly em: EntityManager) {
|
||||
super(em, RestaurantPaymentMethod);
|
||||
}
|
||||
async findOneWithPopulate(id: string): Promise<RestaurantPaymentMethod> {
|
||||
const restaurantPaymentMethod = await this.findOne({ id }, { populate: ['restaurant', 'paymentMethod'] });
|
||||
if (!restaurantPaymentMethod) {
|
||||
throw new NotFoundException('Restaurant payment method not found');
|
||||
}
|
||||
await restaurantPaymentMethod.restaurant.load();
|
||||
await restaurantPaymentMethod.paymentMethod.load();
|
||||
return restaurantPaymentMethod;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user