Ivan Asmer 5 years ago
parent
commit
2a92d855fa
1 changed files with 5 additions and 0 deletions
  1. 5 0
      models.js

+ 5 - 0
models.js

@@ -45,6 +45,11 @@ module.exports = async (dbName='hipstagram') => {
                 super(...params)
                 //TODO: calc likes count by getter (no two-way relation for this to avoid overflow on many Kilos of likes
                 //cached like count, which incremented and decremented
+                //
+                //
+
+                this.comments = this.comments instanceof Array ? 
+                                                this.comments  : this.comments ? [] : [this.comments]
             }
 
             static get relations(){