"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const mongoose = require("mongoose"); const safe = { j: true, w: 'majority', wtimeout: 10000 }; const copyrightHolderSchema = new mongoose.Schema({}, { id: false, _id: false, strict: false }); const offersSchema = new mongoose.Schema({}, { id: false, _id: false, strict: false }); /** * 作品スキーマ */ const schema = new mongoose.Schema({ typeOf: { type: String, required: true }, identifier: String, name: String, alternateName: String, description: String, copyrightHolder: copyrightHolderSchema, copyrightYear: Number, datePublished: Date, license: String, thumbnailUrl: String, duration: String, contentRating: String, offers: offersSchema }, { collection: 'creativeWorks', 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('CreativeWork', schema).on('index', // tslint:disable-next-line:no-single-line-block-comment /* istanbul ignore next */ (error) => { if (error !== undefined) { console.error(error); } });