teacher.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const moment = require('moment');
  2. module.exports = (sequelize, DataTypes) =>
  3. sequelize.define('user', {
  4. id: {
  5. type: DataTypes.INTEGER,
  6. allowNull: false,
  7. primaryKey: true,
  8. autoIncrement: true
  9. },
  10. realName: {
  11. type: DataTypes.STRING(64),
  12. allowNull: false
  13. },
  14. organization: {
  15. type: DataTypes.STRING(64),
  16. allowNull: false,
  17. defaultValue: '南京大学'
  18. },
  19. jobNumber: {
  20. type: DataTypes.STRING(64),
  21. allowNull: false
  22. },
  23. certificate: {
  24. type: DataTypes.STRING(512),
  25. allowNull: false,
  26. defaultValue: ""
  27. },
  28. phone: {
  29. type: DataTypes.STRING(64),
  30. allowNull: false,
  31. unique: 'column'
  32. },
  33. email: {
  34. type: DataTypes.STRING(512),
  35. allowNull: false,
  36. defaultValue: "xxxxx@xxx.com"
  37. },
  38. uid: {
  39. type: DataTypes.INTEGER,
  40. allowNull: false,
  41. unique: 'column'
  42. },
  43. createdTime: {
  44. type: DataTypes.DATE,
  45. allowNull: false,
  46. get() {
  47. return moment(this.getDataValue('createdTime')).format('YYYY-MM-DD HH:mm:ss');
  48. }
  49. },
  50. state: {
  51. type: DataTypes.ENUM,
  52. values: ['identifying', 'identified', 'rejected'],
  53. allowNull: false,
  54. defaultValue: 'identifying'
  55. },
  56. }, {
  57. tableName: 'teacher'
  58. });