2024-10-07 01:54:13 +08:00

52 lines
1019 B
TypeScript

import { sequelize } from '../../../modules/sequelize.ts';
import { DataTypes, Model } from 'sequelize';
import { AppData, AppType } from './app.ts';
export type AppList = Partial<InstanceType<typeof AppListModel>>;
/**
* APP List 管理
*/
export class AppListModel extends Model {
declare id: string;
declare data: AppData;
declare version: string;
declare key: string;
declare uid: string;
}
AppListModel.init(
{
id: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
comment: 'id',
},
data: {
type: DataTypes.JSON,
defaultValue: {},
},
version: {
type: DataTypes.STRING,
defaultValue: '',
},
key: {
type: DataTypes.STRING,
},
uid: {
type: DataTypes.UUID,
allowNull: true,
},
},
{
sequelize,
tableName: 'kv_app_list',
paranoid: true,
},
);
AppListModel.sync({ alter: true, logging: false }).catch((e) => {
console.error('AppListModel sync', e);
});