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

Allow to extend select database options #13

Open
kostyazgara opened this issue Oct 26, 2022 · 0 comments
Open

Allow to extend select database options #13

kostyazgara opened this issue Oct 26, 2022 · 0 comments

Comments

@kostyazgara
Copy link
Contributor

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Currently, we don't have a mechanism to extend default SelectDatabaseOptions with additional custom options. There is only one way how to apply custom SelectDatabaseOptions is override default CRUD methods (list, create, retrieve, etc)

Expected behavior

We need to have a way to extend default SelectDatabaseOptions with custom attributes

Minimal reproduction of the problem with instructions

interface MySelectDatabaseOptions<TRecord, TResult> extends SelectDatabaseOptions<TRecord, TResult>, ListPaginationSelectDatabaseOptions<TRecord, TResult> {}

class TestRepository extends Repository<TestRecord, { idType: string; selectOptions: MySelectDatabaseOptions<TRecord, unknown> }> {}

const listRecords = async (testRepository: TestRepository) => {
  const records = await testRepository.list({
    limit: 20, // <---- should not throw an error
  })
}

What is the motivation / use case for changing the behavior?

It's redundant to create new class which extends Repository and override default types

Environment


Nest version: X.Y.Z

 
For Tooling issues:
- Node version: Any
- Platform:  Any

Others:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant