Skip to content

Commit

Permalink
refactor: rename config getCastKey method to getCastAsKey
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jan 12, 2020
1 parent d050ecc commit 8cca1d4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion adonis-typings/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ declare module '@ioc:Adonis/Lucid/Model' {
*/
export type OrmConfigContract = {
getTableName (model: ModelConstructorContract): string
getCastKey (model: ModelConstructorContract, key: string): string
getCastAsKey (model: ModelConstructorContract, key: string): string
getSerializeAsKey (model: ModelConstructorContract, key: string): string
serialize (model: ModelConstructorContract, key: string): boolean

Expand Down
2 changes: 1 addition & 1 deletion src/Orm/BaseModel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class BaseModel implements ModelContract {

const column: ColumnOptions = {
primary: options.primary || false,
castAs: options.castAs || this.$configurator.getCastKey(this, name),
castAs: options.castAs || this.$configurator.getCastAsKey(this, name),
hasGetter: !!(descriptor && descriptor.get),
hasSetter: !!(descriptor && descriptor.set),
serializeAs: options.serializeAs || this.$configurator.getSerializeAsKey(this, name),
Expand Down
2 changes: 1 addition & 1 deletion src/Orm/Config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const OrmConfig: OrmConfigContract = {
/**
* Returns the cast key (the column name) for a given model attribute
*/
getCastKey (_: ModelConstructorContract, key: string) {
getCastAsKey (_: ModelConstructorContract, key: string) {
return snakeCase(key)
},

Expand Down

0 comments on commit 8cca1d4

Please sign in to comment.