1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- const { DataTypes } = require('sequelize');
- const connect = require('./connect');
- /*
- type: DataTypes.STRING,
- allowNull: false,
- defaultValue:'',
- comment: '名',
- */
- const model = connect.define(
- __filename.slice(__dirname.length + 1).replace('.js', ''),
- {
- id: {
- type: DataTypes.INTEGER,
- autoIncrement: true,
- primaryKey: true,
- comment: 'id',
- },
- name: {
- type: DataTypes.STRING,
- allowNull: false,
- defaultValue: '',
- comment: '名',
- },
- account: {
- type: DataTypes.STRING,
- allowNull: false,
- defaultValue: '',
- comment: '账号',
- },
- phone: {
- type: DataTypes.STRING,
- defaultValue: '',
- comment: '手机号',
- },
- company: {
- type: DataTypes.STRING,
- defaultValue: '',
- comment: '公司',
- },
- cityId: {
- type: DataTypes.INTEGER,
- defaultValue: 0,
- comment: '城市ID',
- },
- provinceId: {
- type: DataTypes.INTEGER,
- defaultValue: 0,
- comment: '省ID',
- },
- deadline: {
- type: DataTypes.STRING,
- defaultValue: '',
- comment: '到期时间',
- },
- pwd: {
- type: DataTypes.STRING,
- defaultValue: '',
- comment: '密码',
- },
- type: {
- type: DataTypes.INTEGER,
- defaultValue: 0,
- comment: '1审定核证机构2资源减排所有方3两个都选',
- },
- lastTime: {
- type: DataTypes.STRING,
- defaultValue: '',
- comment: '上次登录时间',
- },
- },
- {
- comment: '商家',
- hooks: {
- beforeFind(option) {
- if (!option.order) {
- option.order = [['id', 'desc']];
- }
- },
- },
- }
- );
- module.exports = model;
|