Skip to content

Commit

Permalink
fixed collectionName, tableName
Browse files Browse the repository at this point in the history
improved api-path now kebab-case!
  • Loading branch information
melistik committed Mar 11, 2018
1 parent 229ab80 commit 2dd3acc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions generators/service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ module.exports = class extends Generator {
this.props.mongoDb = answers.springData === 'mongodb'
this.props.idClass = this.props.mongoDb ? 'String' : 'Long'

this.props.entityVariable = answers.entityName.charAt(0)
.toLowerCase() + answers.entityName.slice(1)
this.props.entityCamelCase = _.lowerFirst(answers.entityName)
this.props.entityKebabCase = _.kebabCase(answers.entityName)
this.props.entitySnakeCase = _.kebabCase(answers.entityName).replace('-','_')

this.props.entityFolder = answers.entityName.toLowerCase()
// some transformations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class <%= entityName %>Resource extends AbstractCrudRestResource<<%= enti

@Override
protected String getBaseApiUrl() {
return baseApiUrl + "/api/<%= entityVariable %>";
return baseApiUrl + "/api/<%= entityKebabCase %>";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@Slf4j
@RestController
@RequestMapping("/api/<%= entityVariable %>")
@RequestMapping("/api/<%= entityKebabCase %>")
public class <%= entityName %>Controller extends AbstractCrudController<<%= entityName %>Entity, <%= entityName %>Read, <%= entityName %>Write, <%= idClass %>, <%= entityName %>Converter> {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import java.io.Serializable;

<%_ if (mongoDb) { _%>
@Document
@Document(collection = "<%= entityCamelCase %>")
<%_ } else { _%>
@Entity
@Table(name = "<%= entitySnakeCase %>")
<%_ } _%>
@Data
@Builder
Expand Down

0 comments on commit 2dd3acc

Please sign in to comment.