links.js 630 B

12345678910111213141516171819
  1. "use strict";
  2. const Schema = require("mongoose").Schema;
  3. const metaPlugin = require("naf-framework-mongoose/lib/model/meta-plugin");
  4. // 热点资讯表
  5. const links = {
  6. name: { type: String, required: true, maxLength: 200 }, // 名称
  7. linkurl: { type: String, required: false, maxLength: 200 }, // 链接地址
  8. create_time: { type: String, required: false, maxLength: 200 }, // 发布时间
  9. };
  10. const schema = new Schema(links, { toJSON: { virtuals: true } });
  11. schema.index({ id: 1 });
  12. schema.plugin(metaPlugin);
  13. module.exports = (app) => {
  14. const { mongoose } = app;
  15. return mongoose.model("Links", schema, "links");
  16. };