packServer/backend/app/model/doc_section.js
liufumingren b82b07b84f feat(doc): 栏目内容两级结构与悬浮目录
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-10 04:22:52 +08:00

29 lines
1.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
/**
* 文档栏目(doc_sections)
*
* 文档站最外层(顶部 tab),栏目下面**直接**就是内容页 —— 只有两级,不再有分类。
* - `code`:URL 片段(`/doc/<code>/`),**创建后不能改**(改了旧链接就失效)
* - `status`:1 展示 0 隐藏(隐藏后不生成页面,也不再进 sitemap)
* - `sort`:栏目顺序(小的在前)
*/
module.exports = (app) => {
const { BIGINT, STRING, TINYINT, INTEGER } = app.Sequelize;
const DocSection = app.model.define('doc_section', {
id: { type: BIGINT.UNSIGNED, primaryKey: true, autoIncrement: true, comment: '主键' },
code: { type: STRING(32), allowNull: false, unique: true, comment: 'URL 片段(/doc/<code>/)' },
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_sections',
paranoid: true,
comment: '文档栏目表',
});
return DocSection;
};