payment redirect

This commit is contained in:
2025-12-01 10:34:40 +03:30
parent 016e2f24a9
commit d82c850fab
6 changed files with 206 additions and 8 deletions
@@ -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;
}
}