fix: fix switch orgUser is not org

This commit is contained in:
xion 2025-02-17 00:32:06 +08:00
parent a52ae9ea3a
commit 0bf31c94b7
2 changed files with 6 additions and 2 deletions

View File

@ -9,7 +9,7 @@ app
path: 'micro-app',
key: 'upload',
middleware: ['auth'],
description: 'Upload micro app',
description: 'Upload micro app in server',
})
.define(async (ctx) => {
const { files, collection } = ctx.query?.data;
@ -52,7 +52,7 @@ app
.route({
path: 'micro-app',
key: 'deploy',
description: 'Deploy micro app',
description: 'Deploy micro app in server',
})
.define(async (ctx) => {
const { id, key } = ctx.query?.data;
@ -85,6 +85,7 @@ app
.route({
path: 'micro-app',
key: 'unload',
description: 'Unload micro app in server',
})
.define(async (ctx) => {
const { key } = ctx.query?.data;

View File

@ -167,6 +167,9 @@ app
if (!orgUser) {
ctx.throw('org user not found');
}
if (orgUser.type !== 'org') {
ctx.throw('change user is not org, please check');
}
const user = await Org.findOne({ where: { username } });
const users = user.users;
const index = users.findIndex((u) => u.uid === me.id);