()
| 18 | } |
| 19 | |
| 20 | private createModelAst(): ast.Model { |
| 21 | const properties = [ |
| 22 | this.getIdField(), |
| 23 | this.getCreatedAtField(), |
| 24 | this.getUpdatedAtField(), |
| 25 | ].filter(Boolean) as ast.Field[] |
| 26 | |
| 27 | const model: ast.Model = { |
| 28 | type: "model", |
| 29 | name: this.name, |
| 30 | properties, |
| 31 | } |
| 32 | |
| 33 | for (const field of this.fields) field.appendTo(model) |
| 34 | |
| 35 | return model |
| 36 | } |
| 37 | |
| 38 | private getIdField(): ast.Field | undefined { |
| 39 | if (this.fieldExists("id")) return |
no test coverage detected