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

feat: Uniform representation of entity repositories #82

Merged
merged 5 commits into from
Oct 28, 2020

Conversation

seanjparker
Copy link
Collaborator

Resolves #81

This PR cleans up the Entity repository code a bit, it means you no longer have to have a separate repository for each table. They are all now represented by a single class InjectedRepository<T>, an example of how to use the new representation is below:

export class ExampleService implements ExampleServiceInterface {
	private readonly _exampleRepository: Repository<Example>;

	public constructor(exampleRepository: InjectedRepository<Example>) {
		this._exampleRepository = exampleRepository.getRepository(Example);
	}
}

The exampleRepository constructor parameter is automatically injected by inversify at runtime. (The service dependencies are only evaluated once, when the server starts up)

@seanjparker seanjparker requested a review from a team October 27, 2020 16:08
@seanjparker seanjparker self-assigned this Oct 27, 2020
@codecov
Copy link

codecov bot commented Oct 27, 2020

Codecov Report

Merging #82 into master will decrease coverage by 0.18%.
The diff coverage is 86.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #82      +/-   ##
==========================================
- Coverage   76.10%   75.92%   -0.19%     
==========================================
  Files          56       55       -1     
  Lines        1172     1163       -9     
  Branches      114      114              
==========================================
- Hits          892      883       -9     
  Misses        279      279              
  Partials        1        1              
Impacted Files Coverage Δ
src/repositories/repositories.ts 82.35% <78.57%> (-17.65%) ⬇️
src/services/applications/applicantService.ts 80.88% <100.00%> (ø)
...c/services/applications/partialApplicantService.ts 100.00% <100.00%> (ø)
src/services/review/reviewService.ts 81.25% <100.00%> (+0.60%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3177470...5c5adf6. Read the comment docs.

@seanjparker seanjparker merged commit 87da22d into master Oct 28, 2020
@seanjparker seanjparker deleted the feat/auto-entity-repositories branch October 28, 2020 00:16
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.

Automatically generate Entity repositories
2 participants