Sha256: a67289e3427ee09f5904e8ce090014c5c0faacb0dbb74d89a04f51c60c6e1bb0

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 KB

Contents

const mongoose = require('mongoose');
const { DataElementSchema } = require('./basetypes/DataElement');
const Code = require('./basetypes/Code');
const Interval = require('./basetypes/Interval');
const Quantity = require('./basetypes/Quantity');
const DateTime = require('./basetypes/DateTime');
<% unless datatype.downcase.include? 'component' %>const { ComponentSchema } = require('./Component');<% end %>
<% unless datatype.downcase.include? 'facilitylocation' %>const { FacilityLocationSchema } = require('./FacilityLocation');<% end %>
<% unless datatype.downcase == 'id' %>const { IdSchema } = require('./Id');<% end %>
const Any = require('./basetypes/Any');

const [Number, String] = [
  mongoose.Schema.Types.Number,
  mongoose.Schema.Types.String,
];
<% unless datatype == 'Component' || datatype == 'FacilityLocation' %>
const <%= datatype -%>Schema = DataElementSchema({
  <%- for attribute in attrs_with_extras -%>
  <%= attribute[:name] %>: <%= TYPE_LOOKUP_JS[attribute[:type]] -%>,
  <%- end %>
});
<% else %>
const <%= datatype -%>Schema = new mongoose.Schema({
  <%- for attribute in attrs_with_extras -%>
  <%= attribute[:name] %>: <%= TYPE_LOOKUP_JS[attribute[:type]] -%>,
  <%- end %>
});
<% end %>
module.exports.<%= datatype %>Schema = <%= datatype %>Schema;
module.exports.<%= datatype %> = mongoose.model('<%= datatype %>', <%= datatype %>Schema);

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cqm-models-1.0.3 templates/mongoose_template.js.erb
cqm-models-1.0.2 templates/mongoose_template.js.erb
cqm-models-1.0.1 templates/mongoose_template.js.erb
cqm-models-1.0.0 templates/mongoose_template.js.erb
cqm-models-0.8.4 templates/mongoose_template.js.erb