如何才能实现数据库中没有 2 条相同的记录且这 3 列的值组合相同?
@Column()
sector: string;
@Column()
row: string;
@Column()
number: string;
Run Code Online (Sandbox Code Playgroud) 当将第一个管理员插入我的数据库时,我收到此错误消息,但不知道如何解决它:
[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)
到目前为止,其他表工作得很好并且没有错误。
注册服务:
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) 如何访问传递@Res()到我的 graphql 解析器?
这不起作用:
@Mutation(() => String)
login(@Args('loginInput') loginInput: LoginInput, @Res() res: Response) {
return this.authService.login(loginInput, res);
}
Run Code Online (Sandbox Code Playgroud)