start support for songs
This commit is contained in:
@@ -28,24 +28,7 @@ class User {
|
||||
}
|
||||
|
||||
toObj(){
|
||||
let r = {};
|
||||
r.userid = this.userid
|
||||
r.username = this.username;
|
||||
r.profile = this.profile;
|
||||
r.data = this.data;
|
||||
r.username = this.username;
|
||||
r.following = this.following;
|
||||
r.lastUpdate = this.lastUpdate;
|
||||
r.newsFeedCache = this.newsFeedCache;
|
||||
r.notifications = this.notifications;
|
||||
|
||||
r.isGroup = this.isGroup;
|
||||
r.isCourse = this.isCourse;
|
||||
r.isPrivate = this.isPrivate;
|
||||
r.isChat = this.isChat;
|
||||
r.subscribed = this.subscribed;
|
||||
r.pending = this.pending;
|
||||
return r;
|
||||
return { ...this };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
24
def/songs.js
Normal file
24
def/songs.js
Normal file
@@ -0,0 +1,24 @@
|
||||
class Songs {
|
||||
constructor(info) {
|
||||
if (!info || !info.userid) throw "Can not construct empty profile";
|
||||
this.userid = info.userid;
|
||||
this.data = info.data || {};
|
||||
|
||||
const allowedParams = ["title", 'author', "content", "contentHistory", "bpm", "lang", "reactions", "root", 'beatsPerTempo'];
|
||||
for (const key in info) {
|
||||
if (info.hasOwnProperty(key) && allowedParams.includes(key)) {
|
||||
this[key] = info[key];
|
||||
}
|
||||
}
|
||||
this.createdAt = info.createdAt || new Date();
|
||||
this.lastUpdated = info.lastUpdated || this.createdAt;
|
||||
this.comments = info.comments || [];
|
||||
this.reactions = info.reactions || {};
|
||||
}
|
||||
|
||||
toObj() {
|
||||
return { ...this };
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Songs;
|
||||
Reference in New Issue
Block a user