Source: repo/mongoose/model/ticketType.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mongoose = require("mongoose");
const multilingualString_1 = require("../schemaTypes/multilingualString");
const safe = { j: true, w: 'majority', wtimeout: 10000 };
const accountingSchema = new mongoose.Schema({}, {
    id: false,
    _id: false,
    strict: false
});
/**
 * 券種スキーマ
 */
const schema = new mongoose.Schema({
    _id: String,
    typeOf: String,
    name: multilingualString_1.default,
    description: multilingualString_1.default,
    alternateName: multilingualString_1.default,
    acceptedPaymentMethod: mongoose.SchemaTypes.Mixed,
    availability: String,
    availabilityEnds: Date,
    availabilityStarts: Date,
    availableAtOrFrom: mongoose.SchemaTypes.Mixed,
    price: Number,
    priceCurrency: String,
    eligibleCustomerType: mongoose.SchemaTypes.Mixed,
    eligibleDuration: mongoose.SchemaTypes.Mixed,
    eligibleQuantity: mongoose.SchemaTypes.Mixed,
    eligibleRegion: mongoose.SchemaTypes.Mixed,
    eligibleMovieTicketType: String,
    priceSpecification: mongoose.SchemaTypes.Mixed,
    validFrom: Date,
    validThrough: Date,
    accounting: accountingSchema
}, {
    collection: 'ticketTypes',
    id: true,
    read: 'primaryPreferred',
    safe: safe,
    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('TicketType', schema).on('index', 
// tslint:disable-next-line:no-single-line-block-comment
/* istanbul ignore next */
(error) => {
    if (error !== undefined) {
        // tslint:disable-next-line:no-console
        console.error(error);
    }
});