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:
46
src/forms/templates/form.ts
Normal file
46
src/forms/templates/form.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import {UniversalPath} from '../../util'
|
||||
import {Template} from '../../cli'
|
||||
|
||||
const form_template: Template = {
|
||||
name: 'form',
|
||||
fileSuffix: '.form.ts',
|
||||
description: 'Create a new form request validator',
|
||||
baseAppPath: ['http', 'forms'],
|
||||
render(name: string, fullCanonicalName: string, targetFilePath: UniversalPath) {
|
||||
return `import {FormRequest, ValidationRules, Rule} from '@extollo/forms'
|
||||
import {Injectable} from '@extollo/di'
|
||||
|
||||
/**
|
||||
* ${name} object
|
||||
* ----------------------------
|
||||
* This is the object interface that is guaranteed when
|
||||
* all of the validation rules below pass.
|
||||
*/
|
||||
export interface ${name}Form {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* ${name}Request validator
|
||||
* ----------------------------
|
||||
* Request validator that defines the rules needed to guarantee
|
||||
* that a request's input conforms to the interface defined above.
|
||||
*/
|
||||
@Injectable()
|
||||
export class ${name}FormRequest extends FormRequest<${name}Form> {
|
||||
/**
|
||||
* The validation rules that should be applied to the various
|
||||
* request input fields.
|
||||
* @protected
|
||||
*/
|
||||
protected getRules(): ValidationRules {
|
||||
return {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
}
|
||||
|
||||
export { form_template }
|
||||
Reference in New Issue
Block a user