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