I have Schema defined for the location as follows,
locationSchema.js
module.exports = function () {
var locationSchema = {
city: {
type: String
},
latitude: {
type: String
},
country: {
type: String
},
venue: {
type: String
},
located_in: {
type: String
},
state: {
type: String
},
street: {
type: String
},
zip: {
type: String
}
};
return locationSchema;
}
I want to use this schema inside another file which has the parent schema as follows, here i am refering the file for the locationSchema . how should i modify the following?
module.exports = function (dbService) {
var model = null;
var modelName = '_purchase';
var locationSchema = require('CommonSchema/locationSchema');
try {
model = dbService.getModel(modelName);
}
var locationSchema = dbService.createEntityDef(locationSchema)
var eventSchema = dbService.createEntityDef({
eventId: {
type: String
},
name: {
type: String
},
category: {
type: String
},
date: dateSchema,
location: locationSchema
})
It throws an error [ 'Error: Cannot find module \'CommonSchema/locationSchema\'',
via face turn
No comments:
Post a Comment