'use strict'; /** * 文档分类(doc_categories) * * 一行 = 文档站顶部的一个 tab(「快速开始」「设备接入」「常见问题」…)。 * - `code`:URL 片段(`/doc//`),**创建后不能改**(改了旧链接就失效) * - `status`:1 展示 0 隐藏(隐藏后不生成页面,也不再进 sitemap) * - `sort`:tab 顺序(小的在前) */ module.exports = (app) => { const { BIGINT, STRING, TINYINT, INTEGER } = app.Sequelize; const DocCategory = app.model.define('doc_category', { id: { type: BIGINT.UNSIGNED, primaryKey: true, autoIncrement: true, comment: '主键' }, code: { type: STRING(32), allowNull: false, unique: true, comment: 'URL 片段(/doc//)' }, name: { type: STRING(64), allowNull: false, comment: '分类名称(tab 文案)' }, description: { type: STRING(255), allowNull: true, comment: '分类说明(可选)' }, sort: { type: INTEGER.UNSIGNED, allowNull: false, defaultValue: 0, comment: '排序(小的在前)' }, status: { type: TINYINT.UNSIGNED, allowNull: false, defaultValue: 1, comment: '状态:1 展示 0 隐藏' }, }, { tableName: 'doc_categories', paranoid: true, comment: '文档分类表', }); return DocCategory; };