Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID field: use ID metadata from entity #35

Closed
dalssoft opened this issue Dec 12, 2021 · 2 comments · Fixed by #42
Closed

ID field: use ID metadata from entity #35

dalssoft opened this issue Dec 12, 2021 · 2 comments · Fixed by #42
Labels
enhancement New feature or request released Already in production severity-major Item is very important

Comments

@dalssoft
Copy link
Member

With the upcoming release of the "ID field" feature (herbsjs/gotu#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.

@dalssoft dalssoft added the enhancement New feature or request label Dec 12, 2021
@jhomarolo jhomarolo added ready-to-work Item is ready to work on it severity-major Item is very important labels Dec 24, 2021
@euduardo
Copy link

I'm working on this issue.

@jhomarolo jhomarolo added wip and removed ready-to-work Item is ready to work on it labels Jan 15, 2022
euduardo pushed a commit to euduardo/herbs2knex that referenced this issue Jan 15, 2022
added support to identify entity ids automatically

fix herbsjs#35
github-actions bot pushed a commit that referenced this issue Jan 15, 2022
# [1.4.0](v1.3.1...v1.4.0) (2022-01-15)

### Features

* **repository:** adds support to identify entity ids automatically ([d6e2fd2](d6e2fd2)), closes [#35](#35)
@jhomarolo
Copy link
Contributor

🎉 This issue has been resolved in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment