Skip to content

Commit 9495c89

Browse files
authored
Merge pull request #191 from AthennaIO/develop
chore(npm): update dependencies
2 parents 59d40f2 + acd46b9 commit 9495c89

File tree

8 files changed

+10
-9
lines changed

8 files changed

+10
-9
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@athenna/database",
3-
"version": "5.12.0",
3+
"version": "5.13.0",
44
"description": "The Athenna database handler for SQL/NoSQL.",
55
"license": "MIT",
66
"author": "João Lenon <lenon@athenna.io>",

src/models/BaseModel.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ export class BaseModel {
452452
return
453453
}
454454

455-
json[key] = this[key].toJSON ? this[key].toJSON() : this[key]
455+
json[key] = this[key]?.toJSON ? this[key].toJSON() : this[key]
456456

457457
return
458458
}

src/models/annotations/BelongsTo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function BelongsTo<T extends BaseModel = any, R extends BaseModel = any>(
2727

2828
options = Options.create(options, {
2929
isIncluded: false,
30-
// Default will be set later as: RelationModel.schema().getMainPrimaryKeyName()
30+
// Default will be set later as: RelationModel.schema().getMainPrimaryKeyProperty()
3131
primaryKey: undefined,
3232
// Default will be set later as: `${String.toCamelCase(RelationModel.name)}Id`
3333
foreignKey: undefined

src/models/annotations/HasMany.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function HasMany<T extends BaseModel = any, R extends BaseModel = any>(
2727

2828
options = Options.create(options, {
2929
isIncluded: false,
30-
primaryKey: Target.schema().getMainPrimaryKeyName(),
30+
primaryKey: Target.schema().getMainPrimaryKeyProperty(),
3131
foreignKey: `${String.toCamelCase(Target.name)}Id`
3232
})
3333

src/models/annotations/HasOne.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function HasOne<T extends BaseModel = any, R extends BaseModel = any>(
2727

2828
options = Options.create(options, {
2929
isIncluded: false,
30-
primaryKey: Target.schema().getMainPrimaryKeyName() as any,
30+
primaryKey: Target.schema().getMainPrimaryKeyProperty() as any,
3131
foreignKey: `${String.toCamelCase(Target.name)}Id` as any
3232
})
3333

src/models/relations/BelongsTo/BelongsToRelation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class BelongsToRelation {
1919
const RelationModel = relation.model()
2020

2121
relation.primaryKey =
22-
relation.primaryKey || RelationModel.schema().getMainPrimaryKeyName()
22+
relation.primaryKey || RelationModel.schema().getMainPrimaryKeyProperty()
2323
relation.foreignKey =
2424
relation.foreignKey || `${String.toCamelCase(RelationModel.name)}Id`
2525

src/models/relations/BelongsToMany/BelongsToManyRelation.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export class BelongsToManyRelation {
2020
const PivotModel = relation.pivotModel()
2121

2222
relation.pivotTable = relation.pivotTable || PivotModel.table()
23-
relation.relationPrimaryKey = RelationModel.schema().getMainPrimaryKeyName()
23+
relation.relationPrimaryKey =
24+
RelationModel.schema().getMainPrimaryKeyProperty()
2425
relation.relationForeignKey = `${String.toCamelCase(RelationModel.name)}Id`
2526

2627
return relation

0 commit comments

Comments
 (0)