/**
 * Populate DB with sample data on server start
 * to disable, edit config/environment/index.js, and set `seedDB: false`
 */

'use strict';

var Recipe = require('../api/recipe/recipe.model');
var User = require('../api/user/user.model');
var mongoose = require('mongoose');

Recipe.find({}).remove(function() {
  Recipe.create({
    name: 'Pasta alla carbonara',
    owner: '55366e779ab9b28305ebbb07',
    title: 'Pasta alla carbonara',
    minutes: 30,
    description: 'Metti su l\'acqua e butta la pasta',
    people: 4,
    type: 'primo',
    image: '',
    difficulty: 'easy',
    ingredients: [{ name: 'Pasta', qta: '500gr' },{name: 'uova', qta:'6'}],
    tag: ['pasta','primo','uova'],
    ateAt: [],
    price: 'low',
    createdAt: new Date(),
    updatedAt: new Date()
  }, function(data) {
    console.log('DATA:',data);
    console.log('finished populating recipes');
  });
});

User.find({}).remove(function() {
  User.create({
    provider: 'local',
    name: 'Test User',
    email: 'test@test.com',
    password: 'test'
  }, {
    provider: 'local',
    role: 'admin',
    name: 'Admin',
    email: 'admin@admin.com',
    password: 'admin'
  }, function() {
      console.log('finished populating users');
    }
  );
});

@@ -786,55 +786,493 @@
  %7D, 
-function(data) %7B%0A    console.log('DATA:',data);
+%7B%0A    name: 'Risotto agli asparagi',%0A    owner: '55366e779ab9b28305ebbb07',%0A    title: 'Risotto agli asparagi',%0A    minutes: 45,%0A    description: 'Metti su l%5C'acqua e butta il riso',%0A    people: 4,%0A    type: 'primo',%0A    image: '',%0A    difficulty: 'medium',%0A    ingredients: %5B%7B name: 'Riso', qta: '400gr' %7D,%7Bname: 'asparagi', qta:'6'%7D%5D,%0A    tag: %5B'riso','primo','asparagi'%5D,%0A    ateAt: %5B%5D,%0A    price: 'medium',%0A    createdAt: new Date(),%0A    updatedAt: new Date()%0A  %7D, function(data) %7B
 %0A   

Add recipe to seed