herbsjs / herbs2knex

Create repositories using Knex to retrieve and store Entities
Other
7 stars 13 forks source link

ID field: use ID metadata from entity #35

Closed dalssoft closed 2 years ago

dalssoft commented 2 years ago

With the upcoming release of the "ID field" feature (https://github.com/herbsjs/gotu/issues/46), it would be possible to read the entity's metadata and, as a convention, use those IDs that today need to be explicitly defined.

class ItemRepository extends Repository {
    constructor() {
        super({
            entity: Item,
            table: 'aTable',
            ids: ['id'],              // <---- not necessary
            knex: connection
        })
    }

Explicitly defining IDs would still be possible, but not mandatory for entities with IDs.

euduardo commented 2 years ago

I'm working on this issue.

jhomarolo commented 2 years ago

:tada: This issue has been resolved in version 1.4.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: