change admin route
This commit is contained in:
parent
7f410fbaaa
commit
c6539439e9
@ -2,3 +2,6 @@ import './router.ts';
|
|||||||
import './manager.ts';
|
import './manager.ts';
|
||||||
import './npm.ts';
|
import './npm.ts';
|
||||||
import './core.ts';
|
import './core.ts';
|
||||||
|
import { app, appendTo } from './app.ts';
|
||||||
|
|
||||||
|
export { app, appendTo };
|
||||||
|
66
src/admin/models/page.ts
Normal file
66
src/admin/models/page.ts
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
import { sequelize } from '../modules/sequelize.ts';
|
||||||
|
import { DataTypes, Model } from 'sequelize';
|
||||||
|
|
||||||
|
type PageNodeData = {
|
||||||
|
id: string;
|
||||||
|
type: string;
|
||||||
|
data: {
|
||||||
|
label?: string; // 容器 开始 结束
|
||||||
|
// 容器上的属性
|
||||||
|
cid?: string; // 容器code id
|
||||||
|
};
|
||||||
|
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface RouterGraphData {
|
||||||
|
edges: any[];
|
||||||
|
nodes: PageNodeData[];
|
||||||
|
viewport: any;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面数据
|
||||||
|
*/
|
||||||
|
export class RouterGraphModel extends Model {
|
||||||
|
declare id: string;
|
||||||
|
declare title: string;
|
||||||
|
declare description: string;
|
||||||
|
declare type: string;
|
||||||
|
declare data: RouterGraphData;
|
||||||
|
}
|
||||||
|
RouterGraphModel.init(
|
||||||
|
{
|
||||||
|
id: {
|
||||||
|
type: DataTypes.UUID,
|
||||||
|
primaryKey: true,
|
||||||
|
defaultValue: DataTypes.UUIDV4,
|
||||||
|
comment: 'id',
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: DataTypes.STRING,
|
||||||
|
defaultValue: '',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: DataTypes.TEXT,
|
||||||
|
defaultValue: '',
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: DataTypes.STRING,
|
||||||
|
defaultValue: '',
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
type: DataTypes.JSON,
|
||||||
|
defaultValue: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'cf_router_graph',
|
||||||
|
paranoid: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
RouterGraphModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||||
|
console.error('RouterGraphModel sync', e);
|
||||||
|
});
|
@ -1,5 +1,5 @@
|
|||||||
import './demo/index.ts';
|
import './demo/index.ts';
|
||||||
import './admin/index.ts';
|
import { app as adminApp, appendTo } from './admin/index.ts';
|
||||||
import './routes/index.ts';
|
import './routes/index.ts';
|
||||||
import { app } from './app.ts';
|
import { app } from './app.ts';
|
||||||
import { useConfig } from '@abearxiong/use-config';
|
import { useConfig } from '@abearxiong/use-config';
|
||||||
@ -11,3 +11,6 @@ createAuthRoute({
|
|||||||
secret: config.tokenSecret,
|
secret: config.tokenSecret,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// app.importApp(adminApp);
|
||||||
|
|
||||||
|
appendTo(app);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user