fix: add manager config assistant-apps-config
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user