12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import {
- Model,
- DataTypes,
- CreationOptional,
- InferAttributes,
- InferCreationAttributes,
- } from 'sequelize';
- import sequelize from '../sequelizeInstance';
- class Dict extends Model<
- // eslint-disable-next-line no-use-before-define
- InferAttributes<Dict>,
- // eslint-disable-next-line no-use-before-define
- InferCreationAttributes<Dict>
- > {
- declare id: CreationOptional<number>;
- declare key: string;
- declare val: string;
- declare createdAt: CreationOptional<Date>;
- declare updatedAt: CreationOptional<Date>;
- }
- Dict.init(
- {
- id: {
- type: DataTypes.INTEGER,
- autoIncrement: true,
- primaryKey: true,
- },
- key: {
- type: DataTypes.STRING,
- allowNull: false,
- },
- val: {
- type: DataTypes.STRING,
- allowNull: false,
- },
- createdAt: DataTypes.DATE,
- updatedAt: DataTypes.DATE,
- },
- {
- sequelize,
- modelName: 'Dict',
- underscored: true,
- tableName: 'dict',
- }
- );
- export type DictCreationAttributes = InferCreationAttributes<
- Dict,
- { omit: 'id' | 'createdAt' | 'updatedAt' }
- >;
- export default Dict;
|