feat: save single html and update redis
This commit is contained in:
@@ -46,28 +46,28 @@ const add = app.route({
|
||||
add.run = async (ctx) => {
|
||||
const tokenUser = ctx.state.tokenUser;
|
||||
const data = ctx.query.data;
|
||||
|
||||
const _data: Container = {
|
||||
title: '',
|
||||
description: '',
|
||||
code: '',
|
||||
type: '',
|
||||
};
|
||||
const container = {
|
||||
..._data,
|
||||
...data,
|
||||
};
|
||||
let containerModel: any = null;
|
||||
if (container.id) {
|
||||
containerModel = await ContainerModel.findByPk(container.id);
|
||||
if (containerModel) {
|
||||
containerModel.update(container);
|
||||
await containerModel.save();
|
||||
ctx.emit?.('pageEdit', {
|
||||
source: 'container',
|
||||
data: containerModel.toJSON(),
|
||||
operation: 'edit',
|
||||
containerModel.update({
|
||||
...container,
|
||||
publish: {
|
||||
...containerModel.publish,
|
||||
...container.publish,
|
||||
},
|
||||
});
|
||||
await containerModel.save();
|
||||
if (containerModel.code || containerModel.source || containerModel.sourceType) {
|
||||
ctx.emit?.('pageEdit', {
|
||||
source: 'container',
|
||||
data: containerModel.toJSON(),
|
||||
operation: 'edit',
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@@ -123,7 +123,7 @@ app
|
||||
}
|
||||
container.publish = publish;
|
||||
await container.save();
|
||||
const { title, description, key, version, fileName } = publish;
|
||||
const { title, description, key, version, fileName, saveHTML } = publish;
|
||||
ctx.body = container;
|
||||
if (!key || !version || !fileName) {
|
||||
return;
|
||||
@@ -134,6 +134,7 @@ app
|
||||
version: version,
|
||||
code: container.code,
|
||||
filePath: fileName,
|
||||
saveHTML
|
||||
});
|
||||
await ctx.call({
|
||||
path: 'app',
|
||||
@@ -143,7 +144,7 @@ app
|
||||
data: {
|
||||
appKey: key,
|
||||
version,
|
||||
files: [uploadResult],
|
||||
files: uploadResult,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user