-
Notifications
You must be signed in to change notification settings - Fork 454
/
.hygen.js
116 lines (116 loc) · 3.22 KB
/
.hygen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
module.exports = {
templates: `${__dirname}/.hygen`,
helpers: {
ControllerName(name) {
return `${this.ClassName(name)}Controller`;
},
ServiceName(name) {
return `${this.ClassName(name)}Service`;
},
ModuleName(name) {
return `${this.ClassName(name)}Module`;
},
DtoName(name) {
return `${this.ClassName(name)}Dto`;
},
TranslationDtoName(name) {
return `${this.ClassName(name)}TranslationDto`;
},
UpdateDtoName(name) {
return `Update${this.DtoName(name)}`;
},
DtoOptionName(name) {
return `I${this.DtoName(name)}Options`;
},
CreateDtoName(name) {
return `Create${this.DtoName(name)}`;
},
EntityName(name) {
return `${this.ClassName(name)}Entity`;
},
TranslationEntityName(name) {
return `${this.ClassName(name)}TranslationEntity`;
},
CreateCommandName(name) {
return `Create${this.ClassName(name)}Command`;
},
CreateHandlerName(name) {
return `Create${this.ClassName(name)}Handler`;
},
GetHandlerName(name) {
return `Get${this.ClassName(name)}Handler`;
},
GetQueryName(name) {
return `Get${this.ClassName(name)}Query`;
},
PageOptionsDtoName(name) {
return this.ClassName(name) + 'PageOptionsDto';
},
NotFoundExceptionName(name) {
return this.ClassName(name) + 'NotFoundException';
},
entityFileName(name) {
return `${this.fileName(name)}.entity`;
},
translationEntityFileName(name) {
return `${this.fileName(name)}-translation.entity`;
},
translationDtoFileName(name) {
return `${this.fileName(name)}-translation.dto`;
},
repositoryFileName(name) {
return `${this.fileName(name)}.repository`;
},
translationRepositoryFileName(name) {
return `${this.fileName(name)}-translation.repository`;
},
createCommandFileName(name) {
return `create-${this.fileName(name)}.command`;
},
getQueryFileName(name) {
return `get-${this.fileName(name)}.query`;
},
controllerFileName(name) {
return `${this.fileName(name)}.controller`;
},
dtoFileName(name) {
return `${this.fileName(name)}.dto`;
},
notFoundExceptionFileName(name) {
return `${this.fileName(name)}-not-found.exception`;
},
createDtoFileName(name) {
return `create-${this.fileName(name)}.dto`;
},
updateDtoFileName(name) {
return `update-${this.fileName(name)}.dto`;
},
pageOptionsDtoFileName(name) {
return `${this.fileName(name)}-page-options.dto`;
},
serviceFileName(name) {
return `${this.fileName(name)}.service`;
},
moduleFileName(name) {
return `${this.fileName(name)}.module`;
},
ClassName(name) {
return this.changeCase.pascal(name);
},
TableName(name) {
return this.inflection.pluralize(this.inflection.dasherize(name));
},
RepositoryName(name) {
return `${this.ClassName(name)}Repository`;
},
TranslationRepositoryName(name) {
return `${this.ClassName(name)}TranslationRepository`;
},
moduleName(name) {
return this.changeCase.camel(name);
},
fileName(name) {
return this.inflection.dasherize(name).toLowerCase();
},
},
}