fix: update deploy local app
This commit is contained in:
parent
7f91070906
commit
9ac04821f5
@ -18,17 +18,33 @@ app
|
||||
.define(async (ctx) => {
|
||||
const tokenUser = ctx.state.tokenUser;
|
||||
const data = ctx.query?.data;
|
||||
const { id, key, force, install } = data;
|
||||
if (!id) {
|
||||
ctx.throw(400, 'Invalid id');
|
||||
const { id, key, force, install, appKey: postAppKey, version: postVersion = '1.0.0' } = data;
|
||||
if (!id || !postAppKey) {
|
||||
ctx.throw(400, 'Invalid id or postAppKey');
|
||||
}
|
||||
let username = tokenUser.username;
|
||||
if (data.username) {
|
||||
// username = data.username;
|
||||
if (data.username && username === 'admin') {
|
||||
username = data.username;
|
||||
}
|
||||
const microApp = await AppListModel.findByPk(id);
|
||||
let microApp: AppListModel;
|
||||
if (!microApp && id) {
|
||||
microApp = await AppListModel.findByPk(id);
|
||||
}
|
||||
if (!microApp && postAppKey) {
|
||||
microApp = await AppListModel.findOne({
|
||||
where: {
|
||||
key: postAppKey,
|
||||
version: postVersion,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (!microApp) {
|
||||
ctx.throw(400, 'Invalid id');
|
||||
if (id) {
|
||||
ctx.throw(400, 'Invalid id');
|
||||
} else {
|
||||
ctx.throw(400, `Invalid appKey , no found app with key: ${postAppKey} and version: ${postVersion}`);
|
||||
}
|
||||
}
|
||||
const { key: appKey, version } = microApp;
|
||||
const check = await appPathCheck({ key: key });
|
||||
|
@ -25,7 +25,7 @@ export const installAppFromKey = async (key: string) => {
|
||||
}
|
||||
let showAppInfo = {
|
||||
key,
|
||||
status: 'inactive',
|
||||
status: 'inactive' as const,
|
||||
type: app?.type || 'system-app',
|
||||
description: readmeDesc || '',
|
||||
version,
|
||||
|
Loading…
x
Reference in New Issue
Block a user