|
@@ -55,6 +55,7 @@ module.exports = async (dbName='hipstagram') => {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
static get relations(){
|
|
|
return {
|
|
|
}
|
|
@@ -134,6 +135,7 @@ module.exports = async (dbName='hipstagram') => {
|
|
|
|
|
|
|
|
|
static async fromFileData(fileData){
|
|
|
+ if (!fileData) return
|
|
|
let image = new Image({})
|
|
|
image.fileData = fileData
|
|
|
image.url = `images/${fileData.filename}`
|
|
@@ -171,6 +173,17 @@ module.exports = async (dbName='hipstagram') => {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ get likes(){
|
|
|
+ return (async () => {
|
|
|
+ let result = []
|
|
|
+ for (let like of SlicedSavable.m.Like.find({'comment._id': this._id}, {limit: [100], sort: ['_id', 1]})){
|
|
|
+ try {await like; result.push(like) } catch(e) {}
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ })()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
static get relations(){
|
|
|
return {
|
|
|
post: ["comments"],
|