@chevre/domain
Version:
Chevre Domain Library for Node.js
61 lines (60 loc) • 1.64 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.modelName = exports.indexes = void 0;
exports.createSchema = createSchema;
const mongoose_1 = require("mongoose");
const writeConcern_1 = require("../writeConcern");
const settings_1 = require("../../../settings");
const modelName = 'Project';
exports.modelName = modelName;
const schemaDefinition = {
_id: String,
aggregateReservation: mongoose_1.SchemaTypes.Mixed,
alternateName: String,
logo: String,
hasMerchantReturnPolicy: mongoose_1.SchemaTypes.Mixed,
makesOffer: [mongoose_1.SchemaTypes.Mixed],
name: String,
settings: mongoose_1.SchemaTypes.Mixed,
subscription: mongoose_1.SchemaTypes.Mixed,
typeOf: {
type: String,
required: true
}
};
const schemaOptions = {
autoIndex: settings_1.MONGO_AUTO_INDEX,
autoCreate: false,
collection: 'projects',
id: true,
read: settings_1.MONGO_READ_PREFERENCE,
writeConcern: writeConcern_1.writeConcern,
strict: true,
strictQuery: false,
timestamps: false, // 2024-08-07~
versionKey: false, // 2024-08-07~
toJSON: {
getters: false,
virtuals: false,
minimize: false,
versionKey: false
},
toObject: {
getters: false,
virtuals: true,
minimize: false,
versionKey: false
}
};
const indexes = [];
exports.indexes = indexes;
/**
* プロジェクトスキーマ
*/
let schema;
function createSchema() {
if (schema === undefined) {
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
}
return schema;
}
;