UNPKG

@mannguyen/nestcli

Version:

A CLI to create model

18 lines (13 loc) 434 B
import { upperFirst, camelCase } from "lodash"; import { Base } from "./base"; class ManyToOne extends Base { getTemplate(options) { return ` @ManyToOne('${upperFirst(camelCase(options.relationWith))}Entity') @JoinColumn({ name: '${options.foreignKey}' }) ${options.propertyName}: any;`; } } export async function manyToOneTemplate(options) { const instance = new ManyToOne(); return instance.execute(options); }