Import other modules into monorepo
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
30
src/orm/template/model.ts
Normal file
30
src/orm/template/model.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import {Template} from "../../cli"
|
||||
import {UniversalPath} from "../../util"
|
||||
|
||||
/**
|
||||
* Template for creating new database model classes in app/models.
|
||||
*/
|
||||
const model_template: Template = {
|
||||
name: 'model',
|
||||
fileSuffix: '.model.ts',
|
||||
baseAppPath: ['models'],
|
||||
description: 'Create a new class that represents a record in a database',
|
||||
render: (name: string, fullCanonicalName: string, targetFilePath: UniversalPath) => {
|
||||
return `import {Model} from "@extollo/orm"
|
||||
import {Injectable} from "@extollo/di"
|
||||
|
||||
/**
|
||||
* ${name} Model
|
||||
* -----------------------------------
|
||||
* Put some description here.
|
||||
*/
|
||||
@Injectable()
|
||||
export class ${name} extends Model<${name}> {
|
||||
protected static table = '${name.toLowerCase()}';
|
||||
protected static key = '${name.toLowerCase()}_id';
|
||||
}
|
||||
`
|
||||
}
|
||||
}
|
||||
|
||||
export { model_template }
|
||||
Reference in New Issue
Block a user