dygapp f42a8a8cf3 news模块实现 %!s(int64=6) %!d(string=hai) anos
..
README.md c29e37b9a5 Update README.md %!s(int64=7) %!d(string=hai) anos
news.js f42a8a8cf3 news模块实现 %!s(int64=6) %!d(string=hai) anos

README.md

数据模型

'use strict';
const Schema = require('mongoose').Schema;

const SchemaDefine = {
  code: { type: String, required: true, maxLength: 64 },
  name: { type: String, required: true, maxLength: 128 },
  order: Number,
};
const schema = new Schema(SchemaDefine);
schema.index({ code: 1 }, { unique: true });

module.exports = app => {
  const { mongoose } = app;
  return mongoose.model('CodeCategory', schema, 'naf_code_category');
};