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

Updated location Param to Address Object param in Organizations (Updated). #1740

Merged
merged 22 commits into from
Jan 27, 2024

Conversation

Anubhav-2003
Copy link
Contributor

What kind of change does this PR introduce?
A feature.

Issue Number:
#1650
Fixes #

Did you add tests for your changes?
Yes

Snapshots/Videos:

If relevant, did you update the documentation?
No.

Summary

Does this PR introduce a breaking change?
Yes, this PR is an updated PR for the initially merged PR #1666.
This PR must be merged with the corresponding ADMIN portal PR: PalisadoesFoundation/talawa-admin#1490 for successful and complete implementation of the feature.

Other information

Have you read the contributing guide?

No.

Copy link

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

@Anubhav-2003 Anubhav-2003 changed the title Issue 1650 Updated location Param to Address Object param in Organizations (Updated). Jan 24, 2024
@Anubhav-2003
Copy link
Contributor Author

@palisadoes Respected sir, I have created both the PR'S for the ADMIN portal, and the Updated PR for the Talawa-API simultaneously as previously discussed. Both the PR'S must be merged together for the successful implementation of the feature.

Thank You.

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

Attention: 88 lines in your changes are missing coverage. Please review.

Comparison is base (c0468a4) 98.17% compared to head (1080e53) 98.26%.
Report is 191 commits behind head on develop.

Files Patch % Lines
src/utilities/PII/decryption.ts 0.00% 17 Missing ⚠️
src/resolvers/Mutation/updateUserProfile.ts 70.90% 1 Missing and 15 partials ⚠️
src/resolvers/middleware/currentUserExists.ts 45.83% 13 Missing ⚠️
src/utilities/PII/encryption.ts 0.00% 13 Missing ⚠️
src/utilities/PII/isAuthorised.ts 0.00% 11 Missing ⚠️
src/resolvers/Mutation/createPost.ts 87.23% 6 Missing ⚠️
src/resolvers/Mutation/createOrganization.ts 95.40% 4 Missing ⚠️
...tilities/encodedVideoStorage/uploadEncodedVideo.ts 96.29% 3 Missing ⚠️
src/resolvers/Mutation/removeAdvertisement.ts 92.85% 2 Missing ⚠️
...c/resolvers/Query/postsByOrganizationConnection.ts 33.33% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1740      +/-   ##
===========================================
+ Coverage    98.17%   98.26%   +0.08%     
===========================================
  Files          184      206      +22     
  Lines        10767    12709    +1942     
  Branches       835     1054     +219     
===========================================
+ Hits         10571    12489    +1918     
- Misses         186      188       +2     
- Partials        10       32      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Cioppolo14 Cioppolo14 requested review from noman2002 and xoldd January 24, 2024 13:36
@Cioppolo14
Copy link
Contributor

@xoldyckk @noman2002 Please review this PR, there is also a corresponding PR almost ready in talwa-admin (PalisadoesFoundation/talawa-admin#1490).

@Anubhav-2003
Copy link
Contributor Author

Anubhav-2003 commented Jan 24, 2024

@Cioppolo14 Ok ma'am, let me fix the failing tests Thank You.

@@ -66,8 +74,31 @@ const organizationSchema = new Schema(
type: String,
required: true,
},
location: {
type: String,
address: {
Copy link
Contributor

@xoldd xoldd Jan 24, 2024

Choose a reason for hiding this comment

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

confirm which fields are non nullable and add required: true to them

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. City and country code should be mandatory for the purposes of this PR
  2. As country code is unchanging it should be an enum and added to this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok sir, I will make those two mandatory. As for the enums, I have already hardcoded an entire list of objects with country codes and country names in the admin portal for the drop down list. I found that creating an object would be more self-explanatory and better as compared to just an enum. you can find that change in the other PR. Thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@palisadoes @xoldyckk Respected sir, I have made the changes requested, and made countrycode, and city mandatory. But due to this change. Some tests are failing. I will be fixing those tests as early as possible.

Thank You.

@Anubhav-2003
Copy link
Contributor Author

@palisadoes @xoldyckk Respected sir, I have completely implemented the feature both in the API, and the ADMIN, and it is working properly. I have also made the countryCode, and city in the address mandatory from both the ADMIN portal, and the createOrganization resolver. The ADMIN PR has passed all the tests.

But one major problem for making the address countrycode, and city mandatory from the schema level is the fact that currently the location param is not mandatory in the schema. As a result most of the test cases have been created with their own instances of the organization without the location param (and without a single point of truth), now making the address mandatory at that level would require substantial changes to all the test files. Now I can make all the changes but it would take time, as every test file has its own logic which I would need to examine before making the changes.

This would lead to unnecessary delays to this feature that is completely functional. As the fields have already been mandated at the resolver level, as well as from the frontend.

Thank You.

@palisadoes
Copy link
Contributor

palisadoes commented Jan 26, 2024

  1. The issue stated:
    1. Replace the location field with the existing address type
  2. Location is deprecated and must not be supported
  3. The sample data as part of the setup.ts script needs to be updated to support this new requirement
  4. Issues have been created in other repos to support this PR

@Anubhav-2003
Copy link
Contributor Author

Anubhav-2003 commented Jan 27, 2024

@palisadoes Respected sir, I have already made the required changes in the sample data, and the sampleOrganization create resolver to accommodate for the changes in the fields.

The updated data is already part of this PR. I have checked, and the sample data is being imported correctly. I am attaching a screenshot of it too.

I think the PR is good to merge along with the front-end PR in the admin portal.

Thank You.
Screenshot from 2024-01-23 14-18-00

@palisadoes palisadoes merged commit fcc2f8f into PalisadoesFoundation:develop Jan 27, 2024
9 of 11 checks passed
@SiddheshKukade
Copy link
Member

@Anubhav-2003 just wanted to clarify are there any updations required in setup.ts for this? If yes have you implemented them or not? Please reply.

@Anubhav-2003
Copy link
Contributor Author

@SiddheshKukade Respected sir,

Since my change mostly dealt with change in the structure of Organization type. So in terms of initial setup, I had to change the structure of the Sample Organizations, and the utility function that created the sample orgs. No changes were required in my opinion in the setup.ts. I checked, and the updated sample organizations are being imported correctly into the DB after the PR.

Thank You.

@Dante291
Copy link

@Anubhav-2003 I have been assigned to fix this issue in mobile repo, I need some help of yours to fix this but I am unable to find you on slack could you please drop a text to me on slack(same name and pfp) Thanks.

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.

6 participants