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

[Backend] Privacy Experiences Tables and GET List #3146

Merged
merged 6 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions .fides/db_dataset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,165 @@ dataset:
- name: updated_at
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: privacyexperience
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
fields:
- name: acknowledgement_button_label
data_categories: [ system.operations ]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: banner_description
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: banner_title
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: component
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: component_description
data_categories: [ system.operations ]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: component_title
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: confirmation_button_label
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: created_at
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: delivery_mechanism
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: disabled
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: id
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: link_label
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: privacy_experience_template_id
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: regions
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: reject_button_label
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: updated_at
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: version
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: privacyexperiencehistory
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
fields:
- name: acknowledgement_button_label
data_categories: [ system.operations ]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: banner_description
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: banner_title
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: component
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: component_description
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: component_title
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: confirmation_button_label
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: created_at
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: delivery_mechanism
data_categories: [ system.operations ]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: disabled
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: id
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: link_label
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: privacy_experience_id
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: privacy_experience_template_id
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: regions
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: reject_button_label
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: updated_at
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: version
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: privacyexperiencetemplate
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
fields:
- name: acknowledgement_button_label
data_categories: [ system.operations ]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: banner_description
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: banner_title
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: component
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: component_description
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: component_title
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: confirmation_button_label
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: created_at
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: delivery_mechanism
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: disabled
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: id
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: link_label
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: regions
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: reject_button_label
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: updated_at
data_categories: [system.operations]
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
- name: privacynotice
data_categories: []
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ The types of changes are:
- Added Data flow modal [#3008](https://github.com/ethyca/fides/pull/3008)
- Update datamap table export [#3038](https://github.com/ethyca/fides/pull/3038)
- Added more advanced privacy center styling [#2943](https://github.com/ethyca/fides/pull/2943)
- Backend privacy experiences foundation [#3146](https://github.com/ethyca/fides/pull/3146)

### Changed

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
"""privacy experiences

Revision ID: e92da354691e
Revises: 5b03859e51b5
Create Date: 2023-04-24 14:49:37.588144

"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "e92da354691e"
down_revision = "5b03859e51b5"
branch_labels = None
depends_on = None


def upgrade():
op.create_table(
"privacyexperiencetemplate",
sa.Column("id", sa.String(length=255), nullable=False),
sa.Column(
"created_at",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=True,
),
sa.Column(
"updated_at",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=True,
),
sa.Column("disabled", sa.Boolean(), nullable=False),
sa.Column("component", sa.String(), nullable=False),
sa.Column("delivery_mechanism", sa.String(), nullable=False),
sa.Column("regions", sa.ARRAY(sa.String()), nullable=False),
sa.Column("component_title", sa.String(), nullable=True),
sa.Column("component_description", sa.String(), nullable=True),
sa.Column("banner_title", sa.String(), nullable=True),
sa.Column("banner_description", sa.String(), nullable=True),
sa.Column("link_label", sa.String(), nullable=True),
sa.Column("confirmation_button_label", sa.String(), nullable=True),
pattisdr marked this conversation as resolved.
Show resolved Hide resolved
sa.Column("reject_button_label", sa.String(), nullable=True),
sa.Column("acknowledgement_button_label", sa.String(), nullable=True),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_privacyexperiencetemplate_id"),
"privacyexperiencetemplate",
["id"],
unique=False,
)
op.create_index(
op.f("ix_privacyexperiencetemplate_regions"),
"privacyexperiencetemplate",
["regions"],
unique=False,
)
op.create_table(
"privacyexperience",
sa.Column("id", sa.String(length=255), nullable=False),
sa.Column(
"created_at",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=True,
),
sa.Column(
"updated_at",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=True,
),
sa.Column("disabled", sa.Boolean(), nullable=False),
sa.Column("component", sa.String(), nullable=False),
sa.Column("delivery_mechanism", sa.String(), nullable=False),
sa.Column("regions", sa.ARRAY(sa.String()), nullable=False),
sa.Column("component_title", sa.String(), nullable=True),
sa.Column("component_description", sa.String(), nullable=True),
sa.Column("banner_title", sa.String(), nullable=True),
sa.Column("banner_description", sa.String(), nullable=True),
sa.Column("link_label", sa.String(), nullable=True),
sa.Column("confirmation_button_label", sa.String(), nullable=True),
sa.Column("reject_button_label", sa.String(), nullable=True),
sa.Column("acknowledgement_button_label", sa.String(), nullable=True),
sa.Column("version", sa.Float(), nullable=False),
sa.Column("privacy_experience_template_id", sa.String(), nullable=True),
sa.ForeignKeyConstraint(
["privacy_experience_template_id"],
["privacyexperiencetemplate.id"],
),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_privacyexperience_id"), "privacyexperience", ["id"], unique=False
)
op.create_index(
op.f("ix_privacyexperience_regions"),
"privacyexperience",
["regions"],
unique=False,
)
op.create_table(
"privacyexperiencehistory",
sa.Column("id", sa.String(length=255), nullable=False),
sa.Column(
"created_at",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=True,
),
sa.Column(
"updated_at",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=True,
),
sa.Column("disabled", sa.Boolean(), nullable=False),
sa.Column("component", sa.String(), nullable=False),
sa.Column("delivery_mechanism", sa.String(), nullable=False),
sa.Column("regions", sa.ARRAY(sa.String()), nullable=False),
sa.Column("component_title", sa.String(), nullable=True),
sa.Column("component_description", sa.String(), nullable=True),
sa.Column("banner_title", sa.String(), nullable=True),
sa.Column("banner_description", sa.String(), nullable=True),
sa.Column("link_label", sa.String(), nullable=True),
sa.Column("confirmation_button_label", sa.String(), nullable=True),
sa.Column("reject_button_label", sa.String(), nullable=True),
sa.Column("acknowledgement_button_label", sa.String(), nullable=True),
sa.Column("version", sa.Float(), nullable=False),
sa.Column("privacy_experience_template_id", sa.String(), nullable=True),
sa.Column("privacy_experience_id", sa.String(), nullable=False),
sa.ForeignKeyConstraint(
["privacy_experience_id"],
["privacyexperience.id"],
),
sa.ForeignKeyConstraint(
["privacy_experience_template_id"],
["privacyexperiencetemplate.id"],
),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_privacyexperiencehistory_id"),
"privacyexperiencehistory",
["id"],
unique=False,
)
op.create_index(
op.f("ix_privacyexperiencehistory_regions"),
"privacyexperiencehistory",
["regions"],
unique=False,
)


def downgrade():
op.drop_index(
op.f("ix_privacyexperiencehistory_regions"),
table_name="privacyexperiencehistory",
)
op.drop_index(
op.f("ix_privacyexperiencehistory_id"), table_name="privacyexperiencehistory"
)
op.drop_table("privacyexperiencehistory")
op.drop_index(op.f("ix_privacyexperience_regions"), table_name="privacyexperience")
op.drop_index(op.f("ix_privacyexperience_id"), table_name="privacyexperience")
op.drop_table("privacyexperience")
op.drop_index(
op.f("ix_privacyexperiencetemplate_regions"),
table_name="privacyexperiencetemplate",
)
op.drop_index(
op.f("ix_privacyexperiencetemplate_id"), table_name="privacyexperiencetemplate"
)
op.drop_table("privacyexperiencetemplate")
17 changes: 4 additions & 13 deletions src/fides/api/ctl/sql_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,10 @@
from __future__ import annotations

from enum import Enum as EnumType
from typing import (
Any,
Dict,
List,
Optional,
Set,
Type,
TypeVar,
)
from typing import Any, Dict, List, Optional, Set, Type, TypeVar

from fideslang.models import (
DataCategory as FideslangDataCategory,
Dataset as FideslangDataset,
)
from fideslang.models import DataCategory as FideslangDataCategory
from fideslang.models import Dataset as FideslangDataset
from pydantic import BaseModel
from sqlalchemy import ARRAY, BOOLEAN, JSON, Column
from sqlalchemy import Enum as EnumColumn
Expand Down Expand Up @@ -150,6 +140,7 @@ class ClassificationInstance(Base):

DataCategoryType = TypeVar("DataCategoryType", bound="DataCategory")


# Privacy Types
class DataCategory(Base, FidesBase):
"""
Expand Down
Loading