fix: fix错误
This commit is contained in:
@@ -60,11 +60,19 @@ app
|
||||
};
|
||||
return;
|
||||
}
|
||||
const user = await User.createOrg(username, tokenUser.id, description);
|
||||
const user = await User.findByPk(tokenUser.id);
|
||||
if (!user) {
|
||||
throw new CustomError('user not found');
|
||||
}
|
||||
const orgs = await user.getOrgs();
|
||||
if (!orgs.includes('admin')) {
|
||||
throw new CustomError('Permission denied');
|
||||
}
|
||||
const newUser = await User.createOrg(username, tokenUser.id, description);
|
||||
ctx.body = {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
description: user.description,
|
||||
id: newUser.id,
|
||||
username: newUser.username,
|
||||
description: newUser.description,
|
||||
};
|
||||
})
|
||||
.addTo(app);
|
||||
|
||||
Reference in New Issue
Block a user