@chevre/domain
Version:
Chevre Domain Library for Node.js
37 lines (36 loc) • 985 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mongoose = require("mongoose");
const safe = { j: true, w: 'majority', wtimeout: 10000 };
/**
* 興行区分スキーマ
*/
const schema = new mongoose.Schema({
_id: String,
typeOf: String,
name: String,
description: String
}, {
collection: 'serviceTypes',
id: true,
read: 'primaryPreferred',
safe: safe,
strict: true,
useNestedStrict: true,
timestamps: {
createdAt: 'createdAt',
updatedAt: 'updatedAt'
},
toJSON: { getters: true },
toObject: { getters: true }
});
schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
exports.default = mongoose.model('ServiceType', schema).on('index',
// tslint:disable-next-line:no-single-line-block-comment
/* istanbul ignore next */
(error) => {
if (error !== undefined) {
console.error(error);
}
});