feat: add subscribe

This commit is contained in:
2024-09-23 20:51:40 +08:00
parent e828a4c084
commit 9a378275e1
4 changed files with 83 additions and 18 deletions

View File

@@ -61,7 +61,12 @@ add.run = async (ctx) => {
containerModel = await ContainerModel.findByPk(container.id);
if (containerModel) {
containerModel.update(container);
containerModel.save();
await containerModel.save();
ctx.emit?.('pageEdit', {
source: 'container',
data: containerModel.toJSON(),
operation: 'edit',
});
}
} else {
try {
@@ -94,13 +99,12 @@ deleteRoute.run = async (ctx) => {
};
deleteRoute.addTo(app);
const publish = app.route({
path: 'container',
key: 'publish',
});
publish.nextRoute = { path: 'resource', key: 'publishContainer' };
publish
app
.route({
path: 'container',
key: 'publish',
nextRoute: { path: 'resource', key: 'publishContainer' },
})
.define(async (ctx) => {
const { data } = ctx.query;
const { id, publish, type = 'patch', beta = false } = data;