lookinlab / adonis-lucid-soft-deletes

Addon for soft deletes AdonisJS Lucid ORM
MIT License
93 stars 7 forks source link

ERROR #16

Closed wallysonn closed 1 year ago

wallysonn commented 1 year ago

A 'deletedAt' property on type 'User' cannot be assigned to the same property on base type 'LucidRow & { $forceDelete: boolean; DeletedIn: DateTime | null; read-only discarded: boolean; $getQueryFor(action: "insert", client: QueryClientContract): InsertQueryBuilderContract<...>; $getQueryFor(action: "update" | ... 1 more ... | "update", client: QueryClientContract): ModelQueryBuilderContract<...>; delete(): ...'.

wallysonn commented 1 year ago

Any ideas on how to get around this problem? I'm using Adonis 5

LookinGit commented 11 months ago

@wallysonn remove ? for column deletedAt:

Before:

@column.dateTime({ columnName: 'customDeletedAtColumn' })
public deletedAt?: DateTime | null

After:

@column.dateTime({ columnName: 'customDeletedAtColumn' })
public deletedAt: DateTime | null

You don't have to add this block, it is intended for cases when you need to set a custom name from the database for the deletedAt column