(full)
| 27 | |
| 28 | <%= camel %>Schema.methods = { |
| 29 | view (full) { |
| 30 | const view = { |
| 31 | // simple view |
| 32 | id: this.id, |
| 33 | <%_ if (storeUser) { _%> |
| 34 | <%= userField %>: this.<%= userField %>.view(full), |
| 35 | <%_ } _%> |
| 36 | <%_ if (modelFields.length) { _%> |
| 37 | <%_ modelFields.forEach(function (field) { _%> |
| 38 | <%= field %>: this.<%= field %>, |
| 39 | <%_ }) _%> |
| 40 | <%_ } _%> |
| 41 | createdAt: this.createdAt, |
| 42 | updatedAt: this.updatedAt |
| 43 | } |
| 44 | |
| 45 | return full ? { |
| 46 | ...view |
| 47 | // add properties for a full view |
| 48 | } : view |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | const model = mongoose.model('<%= pascal %>', <%= camel %>Schema) |
no outgoing calls
no test coverage detected