小编bra*_*rke的帖子

如何使 typeorm、postgres 中的 3 列组合独一无二?

如何才能实现数据库中没有 2 条相同的记录且这 3 列的值组合相同?

  @Column()
  sector: string;

  @Column()
  row: string;

  @Column()
  number: string;
Run Code Online (Sandbox Code Playgroud)

postgresql typescript typeorm nestjs

15
推荐指数
1
解决办法
1万
查看次数

关系 Y 的 X 列包含空值

当将第一个管理员插入我的数据库时,我收到此错误消息,但不知道如何解决它:

[Nest] 13803   - 04/27/2021, 23:03:02   [TypeOrmModule] Unable to connect to the database. Retrying (6)... +3176ms
QueryFailedError: column "name" of relation "admin" contains null values
Run Code Online (Sandbox Code Playgroud)

到目前为止,其他表工作得很好并且没有错误。

name表中的列admin不为空,它包含值: 管理表

注册服务:

async register(registerInput: RegisterInput): Promise<void> {
    const { key, name, password, email } = registerInput;

    const hashedKey = createHash('sha256')
      .update(key)
      .digest('hex');

    const invite = await this.invitesRepository.findOne({ key: hashedKey });

    if (!invite) {
      throw new UnauthorizedException();
    }

    const newAdmin = await this.adminsRepository.create({
      name,
      password,
      email,
    });
    await this.adminsRepository.save(newAdmin);

    await this.invitesRepository.delete({ id: …
Run Code Online (Sandbox Code Playgroud)

postgresql node.js typescript typeorm nestjs

3
推荐指数
1
解决办法
2776
查看次数

如何在 NestJS GraphQL 解析器中访问 Response 对象

如何访问传递@Res()到我的 graphql 解析器?

这不起作用:

@Mutation(() => String)
  login(@Args('loginInput') loginInput: LoginInput, @Res() res: Response) {
    return this.authService.login(loginInput, res);
  }
Run Code Online (Sandbox Code Playgroud)

node.js typescript graphql nestjs typegraphql

3
推荐指数
1
解决办法
267
查看次数