1234567891011121314151617181920212223242526272829303132333435 |
- 'use strict';
- const db = require('../db');
- module.exports = {
- index: (session, cb) => {
- db.models.song.find({}, (err, songs) => {
- if (err) throw err;
- cb(songs);
- });
- },
- update: (session, id, song, cb) => {
-
- db.models.song.findOneAndUpdate({ id }, song, { upsert: true }, (err, updatedSong) => {
- if (err) throw err;
- cb(updatedSong);
- });
- },
- remove: (session, id, cb) => {
-
- db.models.song.find({ id }).remove().exec();
- },
- add: (session, id, cb) => {
-
-
-
-
-
- }
- };
|