import { sequelize } from '../../../modules/sequelize.ts'; import { DataTypes, Model } from 'sequelize'; export interface ContainerData { style?: { [key: string]: string }; className?: string; showChild?: boolean; shadowRoot?: boolean; } export type ContainerPublish = { rid?: string; // resource id name?: string; description?: string; version?: string; }; export type Container = Partial>; export class ContainerModel extends Model { declare id: string; declare title: string; declare description: string; declare type: string; declare code: string; declare source: string; declare sourceType: string; declare data: ContainerData; declare publish: ContainerPublish; declare uid: string; } ContainerModel.init( { id: { type: DataTypes.UUID, primaryKey: true, defaultValue: DataTypes.UUIDV4, comment: 'id', }, title: { type: DataTypes.STRING, defaultValue: '', }, description: { type: DataTypes.STRING, defaultValue: '', }, type: { type: DataTypes.STRING, defaultValue: '', }, code: { type: DataTypes.TEXT, defaultValue: '', }, source: { type: DataTypes.STRING, defaultValue: '', }, sourceType: { type: DataTypes.STRING, defaultValue: '', }, data: { type: DataTypes.JSON, defaultValue: {}, }, publish: { type: DataTypes.JSON, defaultValue: {}, }, uid: { type: DataTypes.UUID, allowNull: true, }, }, { sequelize, tableName: 'kv_container', }, ); ContainerModel.sync({ alter: true, logging: false }).catch((e) => { console.error('ContainerModel sync', e); });