fix: add manager config assistant-apps-config

This commit is contained in:
2025-05-20 10:48:26 +08:00
parent 1f4404fa5c
commit 6ef9e1218c
5 changed files with 61 additions and 29 deletions

View File

@@ -1,5 +1,6 @@
import { app } from '@/app.ts';
import { AppModel } from '../module/index.ts';
import { ConfigPermission } from '@kevisual/permission';
// curl http://localhost:4005/api/router?path=app&key=public-list
// TODO:
@@ -9,15 +10,28 @@ app
key: 'public-list',
})
.define(async (ctx) => {
const list = await AppModel.findAll({
const { username = 'root', status = 'running', page = 1, pageSize = 100, order = 'DESC' } = ctx.query.data || {};
const { rows, count } = await AppModel.findAndCountAll({
where: {
status: 'running',
status,
user: username,
},
// attributes: {
// exclude: ['data'],
// },
attributes: {
exclude: [],
},
order: [['updatedAt', order]],
limit: pageSize,
offset: (page - 1) * pageSize,
distinct: true,
logging: false,
});
ctx.body = list;
ctx.body = {
list: rows.map((item) => {
return ConfigPermission.getDataPublicPermission(item.toJSON());
}),
pagination: {
total: count,
},
};
})
.addTo(app);