Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. 'use strict';
  2.  
  3. var Report = require('./model.js');
  4.  
  5. module.exports = {
  6. createReport: create,
  7. getReportById: getById
  8. };
  9.  
  10. function create (report, cb) {
  11. var report = new Report(report);
  12. report.save(function (err, report) {
  13. if (err) {
  14. return cb(err);
  15. }
  16.  
  17. cb(null, report);
  18. });
  19. }
  20.  
  21. function getById (reportId, cb) {
  22. Report.findById({
  23. _id: reportId
  24. }, function (err, report) {
  25. if (err) {
  26. return cb(err);
  27. }
  28.  
  29. cb(null, report);
  30. });
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement