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

[CCFPCM-0426] PART 2 db normalization #274

Merged
merged 19 commits into from
Oct 31, 2023
Merged

[CCFPCM-0426] PART 2 db normalization #274

merged 19 commits into from
Oct 31, 2023

Conversation

chelsea-EYDS
Copy link
Collaborator

CCFPCM-0426

Objective:

@chelsea-EYDS chelsea-EYDS force-pushed the CCFPCM-426-PART-2 branch 2 times, most recently from 9c911c7 to 5a64f46 Compare October 31, 2023 00:47
@@ -10,11 +10,13 @@ import { BankLocationEntity, MerchantEntity } from '.';
export class MinistryLocationEntity extends BaseLocationEntity {
@OneToMany(() => BankLocationEntity, (bank) => bank.location, {
cascade: true,
eager: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please justify these eagers

Copy link
Collaborator Author

@chelsea-EYDS chelsea-EYDS Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We almost always need these together - at least to integrate with the current code easily. Could be removed later if we refactor.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the eager from pos deposit and cash deposit, in the case of locations though we need the banks/merchants in most cases

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...not sure if my response is sufficient - please let me know if there is any action needed to resolve 😁

): Promise<NormalizedLocation[]> {
const locations = await this.locationRepo.find({
): Promise<MinistryLocationEntity[]> {
return await this.ministryLocationRepo.find({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're returning straight, I'm pretty sure you don't need the await, as .find is already an async function whose results will be properly returned

@@ -19,7 +19,7 @@ export class CashDepositMock extends CashDepositEntity {
this.deposit_date = dateRange.maxDate;
this.metadata = metadata;
this.deposit_amt_cdn = amount;
this.pt_location_id = location.pt_location_id;
this.pt_location_id = location.banks[0].bank_id;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this always true that pt_location_id corresponds to this? A location won't always have a set of banks right?

I know this is a mock, but I'm curious

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, a location always has a set of banks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, you are correct though, not all banks will necessarily have an entry in the cash deposit files. I am wondering if we should include the method on this table.
(all banks have a location_id, all location_ids have banks, all cash_deposit rows have a pt_location_id which corresponds to a bank_id which corresponds to a location, but since we're storing the bank_id for non cash as well then it's possible that banks[0] would not correspond to a cash type bank_id.)

Base automatically changed from CCFPCM-426 to main October 31, 2023 16:53
@chelsea-EYDS chelsea-EYDS changed the base branch from main to CCFPCM-426-PT-1.1 October 31, 2023 18:27
fw-noel
fw-noel previously approved these changes Oct 31, 2023
Base automatically changed from CCFPCM-426-PT-1.1 to main October 31, 2023 19:11
@chelsea-EYDS chelsea-EYDS dismissed fw-noel’s stale review October 31, 2023 19:11

The base branch was changed.

Copy link

sonarcloud bot commented Oct 31, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@chelsea-EYDS chelsea-EYDS merged commit 16377a0 into main Oct 31, 2023
5 checks passed
@chelsea-EYDS chelsea-EYDS deleted the CCFPCM-426-PART-2 branch October 31, 2023 19:49
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.

2 participants