fix: fix switch orgUser is not org
This commit is contained in:
parent
a52ae9ea3a
commit
0bf31c94b7
@ -9,7 +9,7 @@ app
|
|||||||
path: 'micro-app',
|
path: 'micro-app',
|
||||||
key: 'upload',
|
key: 'upload',
|
||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
description: 'Upload micro app',
|
description: 'Upload micro app in server',
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
const { files, collection } = ctx.query?.data;
|
const { files, collection } = ctx.query?.data;
|
||||||
@ -52,7 +52,7 @@ app
|
|||||||
.route({
|
.route({
|
||||||
path: 'micro-app',
|
path: 'micro-app',
|
||||||
key: 'deploy',
|
key: 'deploy',
|
||||||
description: 'Deploy micro app',
|
description: 'Deploy micro app in server',
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
const { id, key } = ctx.query?.data;
|
const { id, key } = ctx.query?.data;
|
||||||
@ -85,6 +85,7 @@ app
|
|||||||
.route({
|
.route({
|
||||||
path: 'micro-app',
|
path: 'micro-app',
|
||||||
key: 'unload',
|
key: 'unload',
|
||||||
|
description: 'Unload micro app in server',
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
const { key } = ctx.query?.data;
|
const { key } = ctx.query?.data;
|
||||||
|
@ -167,6 +167,9 @@ app
|
|||||||
if (!orgUser) {
|
if (!orgUser) {
|
||||||
ctx.throw('org user not found');
|
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 user = await Org.findOne({ where: { username } });
|
||||||
const users = user.users;
|
const users = user.users;
|
||||||
const index = users.findIndex((u) => u.uid === me.id);
|
const index = users.findIndex((u) => u.uid === me.id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user