You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error
When the handledBy is null, I get the error "status_message": "\"Job.handlingBy\" expects \"handledBy\" to exist on \"User\" model, but is missing",
Reproduction repo
No response
The text was updated successfully, but these errors were encountered:
Package version
20.6.0
Describe the bug
I have a user model in adonis and Job model
In the job model I have the following
Migration
note this foreign key is nullable
... table.integer('handled_by').nullable().unsigned() .references('id').inTable('users') ...
Model
...
@belongsTo(() => User, { localKey: 'handledBy', foreignKey: 'id' })
declare handlingBy: BelongsTo<typeof User>
@column({ columnName: "handled_by" })
declare handledBy: number;
...
Query
await Job.query().where('listedBy', user.id).preload('listingBy').preload('handlingBy')
Error
When the handledBy is null, I get the error
"status_message": "\"Job.handlingBy\" expects \"handledBy\" to exist on \"User\" model, but is missing",
Reproduction repo
No response
The text was updated successfully, but these errors were encountered: