fix: fix错误

This commit is contained in:
2025-02-26 01:59:46 +08:00
parent 69721f3944
commit 3477d098b7
14 changed files with 71 additions and 75 deletions

View File

@@ -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);