小编Ant*_*bbs的帖子

NestJs - 无法让 Injectable 对订阅者起作用

使用订阅者(基于 TypeORM 的数据库)我找不到如何访问请求(让授权用户通过 Rest api 创建预订)

我尝试按照文档中的描述使用 Injectable ,但似乎在这里不起作用。

感谢帮助

预订.subscriber.ts

import { Inject, Injectable, Scope } from '@nestjs/common';
import { throwError } from 'rxjs';
import { Account } from 'src/accounts';
import { Room } from 'src/rooms';
import { TransactionEntity, TransactionsModule } from 'src/transactions';
import {
  EventSubscriber,
  EntitySubscriberInterface,
  InsertEvent,
  getRepository,
  LessThan,
  MoreThan,
} from 'typeorm';
import { Booking } from './booking.entity';
import { REQUEST } from '@nestjs/core';
import { Request } from 'express';

@EventSubscriber()
@Injectable({ scope: Scope.REQUEST }) …
Run Code Online (Sandbox Code Playgroud)

nestjs

5
推荐指数
1
解决办法
1989
查看次数

标签 统计

nestjs ×1