123456789101112131415161718192021222324 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const RoomSchema = {
- name: { type: String, required: false, maxLength: 200 }, // 房间名称
- title: { type: String, required: false, maxLength: 200 }, // 标题
- type: { type: String, required: false, maxLength: 64 }, // 类型0、直播1、会议
- filedir: { type: String, required: false, maxLength: 200 }, // 封面图片
- url: { type: String, required: false, maxLength: 200 }, // 房间地址
- content: { type: String, required: false }, // 直播简介
- anchorid: { type: String, required: false, maxLength: 200 }, // 主播id
- username: { type: String, required: false, maxLength: 200 }, // 主播名称
- status: { type: String, required: false, maxLength: 64, default: '0' }, // 状态0、开启1、关闭
- };
- const schema = new Schema(RoomSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Room', schema, 'room');
- };
|