Skip to content

Commit f3235fb

Browse files
committed
refactor: perform query unification inside query2dto()
1 parent 890073b commit f3235fb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/templates/routes.go.ejs

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ function addTypes(props) {
8585
}
8686
8787
function query2dto(parser, query) {
88+
query = removePlaceholders(query);
8889
const queryAst = parser.astify(query);
8990
const props = extractProperties(queryAst).map(snake2camelCase);
9091
if (props.length === 0) {
@@ -154,7 +155,7 @@ endpoints.forEach(function(endpoint) {
154155
const dtos = endpoint.methods
155156
.filter(method => verbs_with_dto.includes(method.verb))
156157
.map(method => method.query)
157-
.map(query => query2dto(sqlParser, removePlaceholders(query)))
158+
.map(query => query2dto(sqlParser, query))
158159
.filter(elem => elem) // filter out nulls
159160
.filter(dto => !dtoInCache(dto))
160161
.map(dto => dto2struct(cacheDto(dto)))

0 commit comments

Comments
 (0)