@@ -101,6 +101,7 @@ let lib = {
(next) => {
const { name, displayName, songs } = data;
db.models.playlist.create({
+ _id: utils.generateRandomString(17),//TODO Check if exists
displayName,
songs,
createdBy: userId,
@@ -1,4 +1,5 @@
module.exports = {
+ _id: { type: String, min: 17, max: 17, unique: true, index: true, required: true },
displayName: { type: String, min: 2, max: 32, required: true },
songs: { type: Array },
createdBy: { type: String, required: true },
@@ -27,7 +27,7 @@ export default {
removeAllListeners: function () {
Object.keys(this.socket._callbacks).forEach((id) => {
- if (id.indexOf("$event:song") !== -1) {
+ if (id.indexOf("$event:") !== -1) {
delete this.socket._callbacks[id];
}
});