use global context
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Cron } from '@nestjs/schedule';
|
||||
import { CreateRequestContext } from '@mikro-orm/core';
|
||||
import { EntityManager } from '@mikro-orm/postgresql';
|
||||
import { Restaurant } from '../entities/restaurant.entity';
|
||||
|
||||
@@ -14,6 +15,7 @@ export class RestaurantCrone {
|
||||
name: 'deactivateExpiredSubscriptions',
|
||||
timeZone: 'UTC',
|
||||
})
|
||||
@CreateRequestContext()
|
||||
async handleCron() {
|
||||
try {
|
||||
this.logger.debug('Starting daily subscription expiration check');
|
||||
|
||||
@@ -139,10 +139,8 @@ export class RestaurantsService {
|
||||
}
|
||||
|
||||
async findOneBySubscriptionId(subscriptionId: string): Promise<Restaurant> {
|
||||
console.log('subscriptionId', subscriptionId)
|
||||
const restaurant = await this.restRepository.findOne({ subscriptionId });
|
||||
console.log('restaurant', restaurant)
|
||||
if (!restaurant) {
|
||||
const restaurant = await this.restRepository.findOne({ subscriptionId });
|
||||
if (!restaurant) {
|
||||
throw new NotFoundException(RestMessage.NOT_FOUND);
|
||||
}
|
||||
return restaurant;
|
||||
|
||||
Reference in New Issue
Block a user