AppDataSource.initialize().then(async () => {
const condition = { type, identifier: mobile };
const resAuth = await authRepository.findOneBy(condition);
问题:findOneBy()只能传入一个参数,
findOne()也只能传入一个参数,且传入参数的类型更加严格
所以老师的查询代码 { relations: ["user"] } 写不进去
if (resAuth) {
// 查询有结果,老用户
const { userid, nickname, avatar } = resAuth;
问题:只能直接从resAuth中获取用户数据,可以这样做吗??
resAuth.user打印出来是undefined,获取不到用户数据
...
} else {
// 查询无结果,新用户
...
}
}).catch(error => console.log(error));
求老师指导