1234567891011121314151617181920212223242526272829303132333435 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 结算单
- const Bill = {
- title: {
- type: String,
- maxLength: 200,
- default: `${moment().format('YYYY-MM-DD HH:mm:ss')}结算单`,
- }, // 结算单标题
- client: {
- type: String,
- required: true,
- maxLength: 200,
- field: { label: '客户/供应商id', filter: true, required: true },
- },
- ids: { type: Array },
- owner: { type: String, required: true }, // 创建人
- remark: { type: String, maxLength: 200 }, // 备注
- params: { type: Object }, // 额外参数
- create_time: {
- type: String,
- default: moment().format('YYYY-MM-DD HH:mm:ss'),
- },
- };
- const schema = new Schema(Bill, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Bill', schema, 'bill');
- };
|