Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Add Consent Request API #1387

Merged
merged 34 commits into from
Sep 28, 2022
Merged

Add Consent Request API #1387

merged 34 commits into from
Sep 28, 2022

Conversation

sanders41
Copy link
Contributor

@sanders41 sanders41 commented Sep 24, 2022

Purpose

Adds a consent request API

Changes

  • Added routes for consent request.

Checklist

  • Update CHANGELOG.md file
    • Merge in main so the most recent CHANGELOG.md file is being appended to
    • Add description within the Unreleased section in an appropriate category. Add a new category from the list at the top of the file if the needed one isn't already there.
    • Add a link to this PR at the end of the description with the PR number as the text. example: #1
  • Applicable documentation updated (guides, quickstart, postman collections, tutorial, fidesdemo, database diagram.
  • If docs updated (select one):
    • documentation complete, or draft/outline provided (tag docs-team to complete/review on this branch)
    • documentation issue created (tag docs-team to complete issue separately)
  • Good unit test/integration test coverage
  • This PR contains a DB migration. If checked, the reviewer should confirm with the author that the down_revision correctly references the previous migration before merging
  • The Run Unsafe PR Checks label has been applied, and checks have passed, if this PR touches any external services

Ticket

Fixes #1321
Fixes #1161

@sanders41 sanders41 changed the title Ps consent api Consent Request API Sep 24, 2022
@sanders41 sanders41 changed the title Consent Request API Add Consent Request API Sep 26, 2022
@sanders41 sanders41 marked this pull request as ready for review September 26, 2022 02:57
@pattisdr
Copy link
Contributor

Starting review..

CHANGELOG.md Outdated Show resolved Hide resolved
def get_cached_verification_code(self) -> Optional[str]:
"""Retrieve the generated identity verification code if it exists"""
cache = get_cache()
values = cache.get_values([f"IDENTITY_VERIFICATION_CODE__{self.id}"]) or {}
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the rationale for not using .get(key) here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can we use a constant to store, or method to return the IDENTITY_VERIFICATION_CODE__{self.id} so we can only make one update if we change it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is all just a direct copy from PrivacyRequest above

Copy link
Contributor

@seanpreston seanpreston left a comment

Choose a reason for hiding this comment

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

A couple of changes here but all minor, thanks @sanders41

Copy link
Contributor

@pattisdr pattisdr left a comment

Choose a reason for hiding this comment

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

Lots of potential edge cases covered so far, but some bugs found and cleanup needed.

Main concerns are a test email being saved on the providedidentity by default, the unique constraint on consent.data_use that seems incorrect, how we don't expose the consentrequest id anywhere so the user can't make the proper request to get/update preferences, postman collection bugs and deletions of existing endpoints, identity data being required/returned in the responses for getting/saving preferences, new provided identities being created on the consentrequest endpoint create instead of correctly locating the existing one.

Secondary concerns, copy/pasted code that could be shared, minor typos..

@pattisdr
Copy link
Contributor

Switching over to this to do a final pass! assuming it's ready

@sanders41
Copy link
Contributor Author

Switching over to this to do a final pass! assuming it's ready

Yes, I believe everything is ready.

Copy link
Contributor

@pattisdr pattisdr left a comment

Choose a reason for hiding this comment

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

Pass complete @sanders41, a little more clean-up requested, but it felt much more user-friendly this time around so I think it's almost there. Passing in the identity data for updating the consent request preferences still felt unintuitive, but I see we're waiting on @TheAndrewJackson's feedback there.

Copy link
Contributor

@pattisdr pattisdr left a comment

Choose a reason for hiding this comment

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

nice work @sanders41

We might address a new email template in a follow-up based on @TheAndrewJackson's comment #1387 (comment) if needed

@pattisdr pattisdr merged commit 406d3c8 into main Sep 28, 2022
@pattisdr pattisdr deleted the ps-consent-api branch September 28, 2022 13:59
@sanders41
Copy link
Contributor Author

Thanks @pattisdr. I added an issue to follow-up with the new template.

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

Successfully merging this pull request may close these issues.

APIs for ConsentRequest ingest API to record consent preferences
4 participants