(nameOrDef: string | ModelDefinitionSyntax)
| 124 | [attribute: string]: any; // Other attributes |
| 125 | |
| 126 | constructor(nameOrDef: string | ModelDefinitionSyntax) { |
| 127 | if (typeof nameOrDef === 'string') { |
| 128 | nameOrDef = {name: nameOrDef}; |
| 129 | } |
| 130 | const {name, properties, settings, relations} = nameOrDef; |
| 131 | |
| 132 | this.name = name; |
| 133 | |
| 134 | this.properties = {}; |
| 135 | if (properties) { |
| 136 | for (const p in properties) { |
| 137 | this.addProperty(p, properties[p]); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | this.settings = settings ?? new Map(); |
| 142 | this.relations = relations ?? {}; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Add a property |
nothing calls this directly
no test coverage detected