示例#1
0
export default function () {
  Meteor.methods({
    'lots.create'(_id, recordId, productName) {
      check(_id, String);
      check(recordId, String);
      check(productName, String);

      // XXX: Do some user authorization
      const createdAt = new Date();
      const lot = {_id, recordId, productName, createdAt};
      Lots.insert(lot);
    }
  });
}
export default function () {
  if (!Lots.findOne()) {
    for (let lc = 1; lc <= 15; lc++) {
      const recordId = `AB-000${lc}`;
      const productName = `Product ${lc}`;
      const color = `Color ${lc}`;
      const condition = 'B';
      const vendor = 'RE-INV';
      const description = `Description ${lc}`;
      const price = lc;

      Lots.insert({
        recordId,
        productName,
        color,
        condition,
        vendor,
        description,
        price
      });
    }
  }
}