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

patch repository prototype and the prototype extend method #14

Merged
merged 2 commits into from
Nov 18, 2022

Conversation

mekh
Copy link

@mekh mekh commented Oct 13, 2022

This patch allows using either dataSource.getRepository().extend() or custom repositories:

@Injectable()
export class CustomRepository extends Repository<Entity> {
  constructor(private readonly dataSource: DataSource) {
    super(Entity, dataSource.manager);
  }

  async customMethod() {}
}
export const customRepository = dataSource.getRepository(Entity)
    .extend({
      async customMethod(): Promise<any> {
          ...
      },
    });

@Aliheym
Copy link
Owner

Aliheym commented Oct 15, 2022

Hi, thanks for good PR. Do you want to support custom repositories classes from the TypeORM v0.2?

@Aliheym Aliheym self-requested a review October 15, 2022 16:23
@mekh
Copy link
Author

mekh commented Oct 17, 2022

Hi,
I'm maintaining a project that uses typeorm v0.3.7, @nestjs/typeorm v9.0.1 and custom repositories built using this: CustomRepository for typeorm@0.3.x

It would be great to have your module support this approach.

# Conflicts:
#	src/common/index.ts
@mekh mekh reopened this Oct 17, 2022
@AmoOAO
Copy link

AmoOAO commented Nov 17, 2022

This is working for me !!! PLS review & merge it !

@lukeurban
Copy link

Doesn't work :(

@Aliheym Aliheym merged commit 684ae57 into Aliheym:master Nov 18, 2022
@Aliheym
Copy link
Owner

Aliheym commented Nov 19, 2022

Sorry for such delay. I've just released this feature.

@mekh thank you for your PR.

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

Successfully merging this pull request may close these issues.

5 participants