Sha256: b8832728899685e5417a56a0484c8bd1a99591297beabc0b2b790ba283696cd8

Contents?: true

Size: 655 Bytes

Versions: 3

Compression:

Stored size: 655 Bytes

Contents

const mongoose = require('mongoose/browser');

const [Number, String] = [
  mongoose.Schema.Types.Number,
  mongoose.Schema.Types.String,
];

const IdSchema = mongoose.Schema({
  <%- for attribute in attrs_with_extras -%>
  <% if attribute[:default] %><%= attribute[:name] %>: { type: <%= TYPE_LOOKUP_JS[attribute[:type]] -%>, default: '<%= attribute[:default] %>' },<% else %><%= attribute[:name] %>: <%= TYPE_LOOKUP_JS[attribute[:type]] -%>,<%- end %>
  <%- end %>
}, { _id: false, id: false });

module.exports.IdSchema = IdSchema;
class Id extends mongoose.Document {
  constructor(object) {
    super(object, IdSchema);
  }
}
module.exports.Id = Id;

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cqm-models-2.0.1 templates/id_template.js.erb
cqm-models-2.0.0 templates/id_template.js.erb
cqm-models-1.1.1.0 templates/id_template.js.erb